RE: Happy and Macros (was Re: ANNOUNCE: Happy 1.10 released)

S. Alexander Jacobson writes:
I am not a parsing expert, but given the recent discussion on macros, I have to ask: why use happy rather than monadic parsing? Monadic parsing allows you to avoid a whole additional language/compilation step and work in Hugs (where you don't have a makefile). What does Happy buy you here?
It buys you (a) speed, (b) confidence that your grammar is non-ambiguous, and (c) familiar BNF notation. On the down side, as you point out, you lose Haskell's abstraction facilities. I'd be willing to sacrifice (c) in order to write parsers in Haskell, but I don't think there's a combinator library that matches Happy in terms of speed (disclaimer: I haven't exhaustively tested them all, but given the tricks Happy does I'd be surprised). AFAIK none of the combinator libraries gives you (b). Cheers, Simon

Just out of curiosity, has anyone done any work at benchmarking the various parsers? I use Parsec pretty exclusivly since it comes with ghc and is pretty straightforward and lightweight to use. I am wondering what I am giving up in terms of speed by going that route, rather than Happy or the compiler toolkit non-monadic but pure-haskell parser? hmm... John On Thu, May 10, 2001 at 03:42:00PM +0100, Simon Marlow wrote:
S. Alexander Jacobson writes:
I am not a parsing expert, but given the recent discussion on macros, I have to ask: why use happy rather than monadic parsing? Monadic parsing allows you to avoid a whole additional language/compilation step and work in Hugs (where you don't have a makefile). What does Happy buy you here?
It buys you (a) speed, (b) confidence that your grammar is non-ambiguous, and (c) familiar BNF notation. On the down side, as you point out, you lose Haskell's abstraction facilities.
I'd be willing to sacrifice (c) in order to write parsers in Haskell, but I don't think there's a combinator library that matches Happy in terms of speed (disclaimer: I haven't exhaustively tested them all, but given the tricks Happy does I'd be surprised). AFAIK none of the combinator libraries gives you (b).
-- -------------------------------------------------------------- John Meacham http://www.ugcs.caltech.edu/~john/ California Institute of Technology, Alum. john@foo.net --------------------------------------------------------------

"Simon Marlow"
S. Alexander Jacobson writes:
I am not a parsing expert, but given the recent discussion on macros, I have to ask: why use happy rather than monadic parsing? Monadic parsing allows you to avoid a whole additional language/compilation step and work in Hugs (where you don't have a makefile). What does Happy buy you here?
It buys you (a) speed, (b) confidence that your grammar is non-ambiguous, and (c) familiar BNF notation. On the down side, as you point out, you lose Haskell's abstraction facilities.
I'd be willing to sacrifice (c) in order to write parsers in Haskell, but I don't think there's a combinator library that matches Happy in terms of speed (disclaimer: I haven't exhaustively tested them all, but given the tricks Happy does I'd be surprised). AFAIK none of the combinator libraries gives you (b).
I don't think, the point is the test for non-ambiguity. At least, Doitse's and my self-optimising parser combinator library will detect that a grammar is ambigious when you parse a sentence involving the ambiguous productions. So, you can check that by parsing a file involving all grammar constructs of the language. The point is much more the level of help that you get if your grammar happens to be ambiguous. My combinators at the moment just tell you that the grammar is ambiguous, but provide no help as to where and why. I think, this is similar for Doitse's combinators. Happy helps you much more in this situation. Cheers, Manuel

Manuel M. T. Chakravarty (chak@cse.unsw.edu.au) wrote: [received message twice] Am I just the only one or does everybody receive messages posted to haskell@haskell.org and glasgow-haskell-users@haskell.org twice? I find it a bit (I know I am exaggerating) annoying. Is there a way to avoid this? Regards, Marc

* Marc van Dongen
Manuel M. T. Chakravarty (chak@cse.unsw.edu.au) wrote:
[received message twice]
Am I just the only one or does everybody receive messages posted to haskell@haskell.org and glasgow-haskell-users@haskell.org twice? I find it a bit (I know I am exaggerating) annoying. Is there a way to avoid this?
Use procmail to eliminate dups... .procmailrc: :0 Whc: msgid.lock | formail -D 8192 msgid.cache :0 a: duplicates More info: man procmail procmailex procmailrc Cheers, Michael -- () ASCII ribbon campaign | Chair for Computer Science II | GPG: F65C68CD /\ against HTML mail | RWTH Aachen, Germany | PGP: 1D0DD0B9 But... but.... There's no BLINK tag in LaTeX! -- seen on /.
participants (5)
-
John Meacham
-
Manuel M. T. Chakravarty
-
Marc van Dongen
-
michael.weber@post.rwth-aachen.de
-
Simon Marlow