[antlr-interest] [v3] Can't seem to resolve through syntactic predicates...

Mark Mandel mark.mandel at gmail.com
Wed Jun 27 00:35:31 PDT 2007


I have the following grammar, that is essnetially:


tagInnerValues
	:
	(
	{
           complicatedPredicate()
	}?=> tagAttribute*
	)
	|
	(
	{
	(	
		!complicatedPredicate()
	)
	}?=> script
	)
	|
	;

Now, both rules 'tagAttribute', and 'script' use some of the same
tokens in their rules (the EQUALS token to be exact), so
understandably, I get the error:

rule tagInnerValues has non-LL(*) decision due to recursive rule
invocations reachable from alts 1,2,3.  Resolve by left-factoring or
using syntactic predicates or using backtrack=true option

But, I'm confused in that, I have a syntactic predicate - either
tagAttributes OR script are going to be required, never both - so why
am I getting the warning? I would have thought the code above would
have got rid of it.

Side note - got my ANTLR book in the post today :D very excited.

Mark

-- 
E: mark.mandel at gmail.com
W: www.compoundtheory.com


More information about the antlr-interest mailing list