[antlr-interest] Non-LL(*) Constructs

Terence Parr parrt at cs.usfca.edu
Fri Mar 27 09:26:57 PDT 2009


I should mention that, when i do the formal paper, i'll probably say  
that the decision is separable with a DFA but the language of the DFA  
would be a superset of the valid lookahead language.  not sure if that  
will be formally LL(*) or not.
Ter
On Mar 27, 2009, at 7:46 AM, Joseph Klumpp wrote:

> The definitive ANTLR reference uses the following grammar as an
> example of resolving Non-LL(*) Constructs with Syntactic Predicates:
>
> grammar x;
> s : e '%'
>  | e '!'
>  ;
> e : '(' e ')'
>  | INT
>  ;
> INT : '0'..'9' + ;
>
> and notes that this grammar can handle (3)! but cannot handle ((3))!,
> because the DFA cannot figure out what to do when e invokes itself.
> But, e does invoke itself: s=>e! => '(' e ')'! => '('INT')'! =>
> '('3')'!.
>
> My question is:
> Why does this work with one recursive invocation, but not two or more?
>
> Thanks in advance,
> JK
>
> 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