[antlr-interest] Left factor? Syntactic predicates? Or another solution?
Naveen Chawla
naveen.chwl at googlemail.com
Thu Oct 1 03:13:50 PDT 2009
I am trying to write an English grammar with ANTLR and have simplified a
particular problem to a particular subset for your convenience. (I'm using
ANTLRWorks 1.3)
grammar predicate;
predicate : 'verb' complement?;
complement: indirectObject? object;
indirectObject : nounPhrase;
object : nounPhrase;
nounPhrase : 'the' adjectivePhrase? 'noun';
adjectivePhrase : '<Ving>'
complement?;
gives
"error(211): predicate.g:7:14: [fatal] rule complement has non-LL(*)
decision due to recursive rule invocations reachable from alts 1,2. Resolve
by left-factoring or using syntactic predicates or using backtrack=true
option."
Is somebody easily able to left-factor this while preserving the grammar? Or
syntactically predicating if better? Sorry if I sound daft! I should say
that taking away the "?" from either adjectivePhrase or indirectObject does
not produce this error, but they are necessary.
Many thanks!
N
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091001/af0bed59/attachment.html
More information about the antlr-interest
mailing list