[antlr-interest] some v4 examples

Terence Parr parrt at cs.usfca.edu
Mon Jan 2 09:30:31 PST 2012


On Jan 1, 2012, at 8:32 PM, Kyle Ferrio wrote:

> Wow.  After just a few minutes with the R example I am really enjoying the
> (direct) left recursion.  I have not played with associativity yet, but I
> will.  Honey Badger takes my favorite aspects of flex/bison and makes them
> better with LL(*).  I think most of us have to embed algebraic parsers in
> larger DSLs pretty often.  Being able to use left-recursion directly makes
> it really easy to see what's going on.  Woot!

Honey badger will take whatever you give it, as long as it is not indirectly left recursive. It doesn't give a shit. :)

> By the way, not that anyone else would be crazy ewnough to do this, but I
> threw the R example from http://www.mayin.org/ajayshah/KB/R/html/b1.html at
> TestRig -gui and it failed to render on my box.  Could be a memory issue
> but -print and -tokens worked just fine.  It looks like the dotviz-esque
> gui window was created and disappeared before I could see it.  No matter,
> TestRig is a very handy tool and not meant to be an IDE.

The R grammar requires the special TestR.java test rig because I put a filter between the lexer in the parser so that it handles the context-sensitive newlines properly. In other words, it ignores newlines within an expression but still uses \n to terminate expressions. took me quite a long time to figure out the optimal solution.

Ter


More information about the antlr-interest mailing list