[antlr-interest] predicate question
Gerald Rosenberg
gerald at certiv.net
Mon May 5 19:17:40 PDT 2008
Is the question whether
a : {p1}? {action();} {p2}? A | A ;
should perform differently from
a : {p1}? {action(); return true;}? {p2}? A | A ;
From a high level the-grammar-as-a-language point of view, seems
like those two rules should match equivalently.
At 06:20 PM 5/5/2008, Terence Parr wrote:
>Consider:
>
>parser grammar T;
>
>a : {p1}? {action} {p2}? A
> | A
> ;
>
>Someone pointed out that p2 should not be tested out of context (i.e.,
>before action executes). ANTLR v2 (PCCTS) correctly ignored preds
>after actions. v3 definitely walks right over actions looking for
>preds. I propose to prevent p2 from being hoisted into the decision
>for rule 'a'. Right now it generates enclosed DFA. After fix, it
>would only see p1. Not sure how to fix just yet, but i'll figure it
>out.
>
>Contrary opinions?
>
>Ter
>
>
>
>
More information about the antlr-interest
mailing list