[Mono-list] parse generator

Kunle Odutola kunle.odutola@virgin.net
Sun, 9 Feb 2003 13:43:38 -0000

> -----Original Message-----
> From: mono-list-admin@lists.ximian.com
> [mailto:mono-list-admin@lists.ximian.com]On Behalf Of Derek Gottfrid
> Sent: 05 February 2003 01:44
> To: mono-list@lists.ximian.com
> Subject: [Mono-list] parse generator
> i am looking for a parse generator for c#. i looked at jay but it is not
> much to my liking - anybody used antlr w/ c# option?

DISCLAIMER: I am one of ANTLR C# codegen's developers.

Right you asked, "anyone used antlr w/ c# option?"

Yes. ANTLR is an LL(k) parser with a few nice tricks up it's sleeve that
allow it to use arbitary amounts of lookahead to parse even the most
fiendishly ambiguous grammars (case in point: there is a working C++
front-end developed in ANTLR for instance). Developing an LL(k) grammar is a
little different from LR(k) grammars but ANTLR's EBNF syntax makes it an
enjoyable activity.

ANTLR's strength includes the fact that the generated parsers can build ASTs
automatically (with in-built visualization support), you can specify a
grammar to build all sorts of tree walkers (e.g. typecheckers,
pretty-printers, optimizers, translators) and, error handling support - for
Lexers, Parsers and TreeParsers - is flexible and very useful indeed.

To top it all, ANTLR generated Lexers, Parsers and TreeWalkers are
human-readable. Yep, the generated code is similar to what a developer would
write so, you can read and follow the generated code quite easily -
debugging your embedded action code in ANTLR lexers/parsers/treeparsers is a

Even though you are probably interested in generating C#
lexers/parsers/treeparsers, it is worth mentioning that ANTLR can generate
C++ and Java too - with a Python codegen on the way.

There are also a few tools within the active community to help maintain
multi-language grammars, help with testing, grammar debugging etc.