[Haskell-cafe] ANNOUNCE: Grempa 0.1.0, Embedded grammar DSL and LALR parser generator

Olle Fredriksson fredriksson.olle at gmail.com
Tue Sep 7 04:38:39 EDT 2010


>
> Looks like Applicative style.  This is good, even while I don't really
> know why we are seeing <@> and <#> instead of <$> and <*>.
>
> How does Grempa compare with other parsing libraries/tools, such as
> Parsec, Attoparsec and Happy, with regard to ease of use and
> performance?
>
> Cheers! =)
>
> --
> Felipe.
>

Yes, it is indeed in applicative style. The reason for <@> and <#> is that
the functions have slightly different constraints to them, compared to the
Applicative equivalents. The arguments passed to the function have to be
instances of the ToSym class, which converts terminals and non-terminals to
symbols. This allows writing the grammars in the way seen above ("Plus <@> e
<# '+' <#> t") instead of something like "Plus <@> nont e <# tok '+' <#>
nont t".

I have yet to do any library comparisons on performance, but it should be
faster than monadic combinator style libraries, as it does not have the
exponential corner-cases that those parsers can have. It is also easier to
write the grammars in Grempa's BNF-like syntax where left-recursion is
permitted. Some comparison benchmarks would be interesting though, and I
will look into it in the future. I have already done some profiling to
eliminate the worst deficiencies of Grempa, but there is definitely room for
improvements still.

The library does not do lexing for you, which some of the other libraries
have support for, which can make it harder to use. A plus for me (compared
to Happy) is that you do not have to run an external program every time your
grammar has changed, but can instead just recompile your project.

I'm glad to see some interest in the project!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100907/74034e6b/attachment.html


More information about the Haskell-Cafe mailing list