[antlr-interest] predicate question

Terence Parr parrt at cs.usfca.edu
Mon May 5 18:20:28 PDT 2008


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: T.dec-1.png
Type: image/png
Size: 14289 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080505/c1f2cbd4/attachment.png 
-------------- next part --------------



More information about the antlr-interest mailing list