[Haskell-cafe] C++ Parser?
Jason Dagit
dagitj at gmail.com
Tue Jan 24 17:54:30 CET 2012
On Tue, Jan 24, 2012 at 8:40 AM, Christopher Brown
<cmb21 at st-andrews.ac.uk> wrote:
> Hi Jason,
>
> Thanks very much for you thoughtful response.
>
> I am intrigued about the Happy route: as I have never really used Happy before, am I right in thinking I could take the .gr grammar, feed it into Happy to generate a parser, or a template for a parser, and then go from there?
That's the basic idea although the details will be harder than that.
Happy is a parser generator (like Bison, Yacc, and ANTLR). Happy and
elsa will have very different syntax for their grammar definitions.
You could explore taking the elkhound source and instead of generating
C++ you could generate the input for happy, if that makes sense. A
translation by hand would probably be easiest.
I would highly recommend making a few toy parsers with Happy + Alex
(alex is like lex or flex) to get a feel for it before trying to use
the grammar from elsa.
A quick google search pointed me at these examples:
http://darcs.haskell.org/happy/examples/
Jason
More information about the Haskell-Cafe
mailing list