[antlr-interest] much improved LL(*) analysis errors

Terence Parr parrt at cs.usfca.edu
Fri Jul 21 17:03:26 PDT 2006


Hi, some days you just get lucky.  Been racking my brain trying to  
find a more graceful way of "failing" to analyze a decision with LL 
(*).  ANTLR was taking 18s to handle a Java grammar directly ripped  
from Rats! packrat parser.  It turns out that the set of decisions  
for which ANTLR times out is the same set (so far) of non-LL(*)  
decisions.  Morever, I'm able to detect this situation quickly and  
report rather than timing out. Errors look like:

java.g:468:23: [fatal] rule concreteDimensions has non-LL(*)
     decision due to recursive rule invocations in alts 1,2.  Resolve
     by left-factoring or using syntactic predicates with fixed k
     lookahead or use backtrack=true option.

For the full story, check this out:

http://www.antlr.org/blog/antlr3/lookahead.tml

Ter


More information about the antlr-interest mailing list