3

I spent the morning figuring out the basics ANTLR to find out it's LL, only. I need to keep left recursion in my grammar so that the syntax tree has left-to-right associativity.

EDIT 2: Recently I was in need of another parser-generator. While MPLex and MPPG worked they were somewhat lengthy to configure, so I thought I'd look again. This time I came across Hime Parser Generator - in a matter of an hour or two I had a parser converting basic expressions to LINQ Expressions that could be compiled and invoked. It's stupid simple and I recommend it over MPLex and MPPG.

EDIT 1: GOLD Parser does what I needed but its source isn't available so that barred it from being used.

MPLex and MPPG are official Microsoft products that are Lex/Flex and Bison/Yacc, respectively. There isn't much documentation on them, and they're not quite clones of said open source projects, but it was possible to do what I needed with those. If you don't have to deal with real-world politics, I'd recommend GOLD, as it has a nice debugging GUI and everything, but if you're forced to either open-source or Microsoft-official projects, MPLex and MPPG may be the way to go. Note that said two applications are really just derivatives of GPLEX and GPPG. The latter two may be more up-to-date than Microsoft's derivatives since I think Microsoft abandoned the project. The only documentation I could find for Microsoft's derivatives are contained in two PDF's in the VS 2008 SDK. Microsoft took the pdf's out explaining their usage, in spite of shipping the exe's with VS 2010 SDK. It looks like neither pdf's nor the exe's are going to be shipped with 2012, though.

Jesus is Lord
  • 14,971
  • 11
  • 66
  • 97
  • You didn't describe your end goal, but parsing is hardly ever enough, and so parser generators are hardly ever enough. See my essay on Life After Parsing: http://www.semanticdesigns.com/Products/DMS/LifeAfterParsing.html – Ira Baxter Jul 19 '12 at 19:52
  • I have an expression engine that takes a tree structure of objects and evaluates them. If I had an abstract syntax tree converting that to my tree structure would be very straight-forward. I figure there must be a tool that does this. I want left and right recursion permissible in the grammar if possible because then it'd be straight-forward for me to distinguish between those kinds of associativity. I know I could describe evaluation inside the grammar description files, but the point of this was to have something generic broken down into certain components. – Jesus is Lord Jul 19 '12 at 21:45

1 Answers1

2

One of the more popular ones that generates C# code would be: GOLD Parsing System (LALR).

For a comparison of many parser generators, see: http://en.wikipedia.org/wiki/Comparison_of_parser_generators

Bart Kiers
  • 166,582
  • 36
  • 299
  • 288