[antlr-interest] ANTLRworks rule left recursion removal

Ludwig Maes ludwig.maes at gmail.com
Mon Mar 26 16:25:22 PDT 2012


Hi, I removed the simpler left recursions and now I ran into my first
mutual left recursion... I can not actually identify the recursion. It
would be helpful if ANTLR or ANTLRWorks spit out the (first
encountered?) recursion loop instead of just the names of the mutually
recursive functions...

See my attached cpp grammar

On 13 March 2012 20:51, Eric <researcher0x00 at gmail.com> wrote:
>
>
> On Fri, Mar 9, 2012 at 7:40 PM, Ludwig Maes <ludwig.maes at gmail.com> wrote:
>>
>> Hi, I was wondering how the algorithm for left recursion removal
>> works? Does it have a name, where can I find good introductions about
>> them, or more detailed papers? How safely can I use it (is it always
>> functionally identical to the rule before removal)?
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
> Have you seen:
> http://www.antlr.org/wiki/display/ANTLR3/Left-Recursion+Removal
>
> There is not much to it and is described in most compiler books and at
> Wikipedia.
>
> http://en.wikipedia.org/wiki/Left_recursion
>
> Note:There is a bug with it in ANTLRWorks when comments are involved.
> See:
> http://antlr.markmail.org/search/?q=left+recursion#query:left%20recursion+page:1+mid:sstiupbjrn4ovlzu+state:results
>
>
> Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpp.g
Type: application/octet-stream
Size: 33746 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20120327/8fd37bc4/attachment.obj 


More information about the antlr-interest mailing list