[antlr-interest] tool for left recursion removal
Suman Karumuri
mansuk at gmail.com
Sat Oct 29 15:00:44 PDT 2005
Hi Eric,
Why not create a ruby code generation for antlr?
I understand that antlr 2.x syntax is designed with java in mind,
which makes it rather inelegent from a design perspective when your
target language is python, because python parsers like sparc, PLY use
the power of python to get elegent designs.
However, developing a backend for antlr is still worth it because, it
gives you the flexibility to move across languages. For example i am
generating python code for the prototype, but for the production code
i would be generating c/c++ for the same grammar which is a nice thing
to have.
-Suman
On 10/30/05, Eric Mahurin <eric_mahurin at yahoo.com> wrote:
> Hey all, even though I haven't used ANTLR in about a year or
> so, I still take inspiration from it. I ended up designing my
> own LL(1/infinite) parser in Ruby and I started with ideas from
> ANTLR. Unlike other parsers, you specify the grammar directly
> in the target language so that integration with logic outside
> the grammar is easy. The same techniques could be applied to
> any other OO language, but it would be better if the language
> had operator overloading and closures (Java has neither).
> Here's a link if anyone is interested:
>
> http://rubyforge.org/projects/cursor/
>
> Anyways, back to my real question. Like other LL parsers, the
> big problem is dealing with grammars that have left-recursion.
> I found many links on the techniques to remove left-recursion.
> But, what I would really like is some tool that took a grammar
> (.y file maybe), removed the left-recursion, and spit out a new
> grammar (also a .y file). Maybe also did left factoring.
> Anybody know of something that does this?
>
> Eric
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
More information about the antlr-interest
mailing list