[antlr-interest] Help with syntactic predicates vs. non-LL(*) decisions.
Terence Parr
parrt at cs.usfca.edu
Thu Jun 7 11:52:01 PDT 2007
On Jun 7, 2007, at 7:24 AM, Robin Davies wrote:
> I was under the impression that an ANTL semantic predicate would
> cure the issue. But maybe I'm missing a subtlety.
Hi Robin. I think you mean syntactic predicates you're not semantic. ;)
> Here are the offending rules, with a semantic predicate applied:
>
> qualifiedname
> : ID '::' type_or_generic
> -> ^(EXTERNQNAME ID type_or_generic)
> | type_or_generic('.' type_or_generic)*
> -> ^(QNAME type_or_generic*)
> ;
> type_or_generic
> : (ID '<' {TypeArgumentPredicateTest()}?) =>
> ID '<' typedeclaration (',' typedeclaration)* '>'
> | ID
> ;
You have these syntactic predicates in the rule that doesn't need
it. ;) I believe you will need to syntactic predicates up in
qualified name.
Or just turn on backtrack=true and antlr will do the right thing. :)
Ter
More information about the antlr-interest
mailing list