[antlr-interest] the nihilistic circle hoist

Ron Burk ronburk at gmail.com
Fri Dec 31 21:14:26 PST 2010


More fun with predicate hoisting:

grammar Simple;

FOO : 'foo' ;

section : element* unrelated EOF ;
element : {P1}?=> pre;
pre : FOO post ;
post : FOO*;
unrelated : ':' post;

In this grammar, the generated code invokes P1
(completely outside its intended syntactic context)
while trying to recognize an "unrelated" (because P1 was
"hoisted downward" into "post", and "post" is reachable via
a nonterminal unrelated to "element").


More information about the antlr-interest mailing list