[antlr-interest] SLL(2) in "The Definitive ANTLR Reference"

Alan D. Cabrera list at toolazydogs.com
Wed Feb 2 12:54:32 PST 2011


Ahh, the DFA for the 'r' rule.  That makes sense now.  Interesting example.

Thanks Terence and Sam!


Regards,
Alan

On Feb 2, 2011, at 11:17 AM, Terence Parr wrote:

> try for rule 'r' though ;)
> Ter
> On Feb 2, 2011, at 9:07 AM, Alan D. Cabrera wrote:
> 
>> I was reading about the following grammar on page 287 of the PDF document
>> 
>> grammar t;
>> s : X r A B
>> | Y r B
>> ;
>> 
>> r : A
>> |
>> ;
>> 
>> I don't see where the problem is since the alternatives in s begin with two different tokens X and Y.  I think that since these two tokens are different I can easily construct a DFA that would unambiguously parse a stream of tokens.
>> 
>> I sense that this example was supposed to bring out a finer point about how ANTLR generates parsers but I'm afraid that it is being lost on me.
>> 
>> 
>> Regards,
>> Alan
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list