[antlr-interest] ANTLRworks rule left recursion removal
Ludwig Maes
ludwig.maes at gmail.com
Mon Mar 26 16:29:06 PDT 2012
I also had a strange "left recursion removal" for a rule without any
comments (it brought the rule-delimiting ; inside the rule and it was
not righteous...
just to be clear, looking at the examples on mutual left recursion I
have the impression that recursive (even mutual) still define a
grammar/language (is this right or wrong?), just not one that antlr
will accept into its parsing strategy... could mutual recursion be
resolved automatically (algorithmically) as well?
On 27 March 2012 01:25, Ludwig Maes <ludwig.maes at gmail.com> wrote:
> 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
More information about the antlr-interest
mailing list