[EMAIL PROTECTED] (Martin Erwig) wrote,
> I am wondering what is the best way (in terms of
> easy-to-use and easy-to-install) to use a parser
> for Haskell in Hugs. As far as I know the parsers
> by Sven Panne and Manuel Chakravarty require ghc.
I didn't write a parser for parsing Haskell - I only wrote a
parser and lexer library for writing parsers in Haskell.
Sven and Sigbjorn(?)'s parser is not complete yet, as far as
I know. Unfortunately, infix declarations etc make it quite
a hassle to write a parser for Haskell and to be honest, I
doubt that you get it to work in Hugs with reasonable
efficiency (maybe if you carefully hand code it)[1] - a
Happy-generated parser will definitely get too big.
However, what may be interesting is that Roman Lechtchinsky
<[EMAIL PROTECTED]> is currently implementing a parser
for at least a subset of Haskell using my libraries[2].
While he is working with GHC, there is nothing fundamental,
I believe, which would prevent you from using his code in
Hugs (apart from maybe the efficiency)[3]. The parser
library needs one non-standard feature (existential type
variables), but you have this in GHC and Hugs.
> In any case, wouldn't it be a good idea to include
> with each Haskell implementation a module "AST"
> that defines a representation of Haskell programs
> and offers functions like "parse" and "print"?
Would be cool. Ideal would be a whole meta-programming
library, but its a lot of work, I believe.
Cheers,
Manuel
PS: If anybody ever needs a parser for C implemented in
Haskell, that's something where I could help out.
[1] "With reasonble efficiency" here means taking less than
5 minutes for a 10 line program (if you manage not to
run out of memory, that is).
[2] <shameless plug>
There is now a paper on the self-optimising lexer
library at
http://www.score.is.tsukuba.ac.jp/~chak/papers/Cha99.html
</shameless plug>
[3] The whole Compiler Toolkit tries to be as portable as
possible, which means all system-dependent code is
located in a single module and only uses features, which
I expect - in one way or another - to be available in
any Haskell system.