[antlr-interest] On to the next issue: error(211)

Johannes Luber jaluber at gmx.de
Mon Nov 10 04:27:08 PST 2008


Hendrik Maryns schrieb:
> HI,
> 
> Ok, so the ‘token file not found’ issue seems to be bogus, but here is
> the next problem with my grammar:
> 
> error(211): fsqTreeParser.g:68:3: [fatal] rule body has non-LL(*)
> decision due to recursive rule invocations reachable from alts 3,5.
> Resolve by left-factoring or using syntactic predicates or using
> backtrack=true option.
> 
> Strangely, the parser grammar contains the exact same rule, but does not
> give this error message.
> 
> Here is the relevant rule:
> 
> body returns [Formula result]
>   : label { $result = $label.result; }
>   | atomic { $result = $atomic.result; }
>   | unary { $result = $unary.result; }
>   | binary { $result = $binary.result; }
>   | n_ary { $result = $n_ary.result; }
>   | quantor { $result = $quantor.result; }
>   ;
> 
> Indeed, the unary, binary, n_ary and quantor rules (indirectly) refer to
> formula:
> 
> formula returns [Formula result]
>   : ^(FORMULA body) { $result = $body.result; }
>   ;
> 
> What would be the proper thing to do here?  Adding backtrack=true does
> fix it, but I am not sure whether that is a good idea?
> 
> You might notice that I am trying to implement a parser for some logic
> here.
> 
> H.

Try the description of
<http://www.antlr.org/wiki/display/ANTLR3/How+to+remove+global+backtracking+from+your+grammar>.

Johannes
> 
> 
> ------------------------------------------------------------------------
> 
> 
> 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