[antlr-interest] lexical rule problem

Safiye Celik safisce at gmail.com
Mon Aug 24 23:06:27 PDT 2009


Hi,
I have to write a lexical rule such as

a: b c b
b: D | E

and I want 'b' tokens in rule 'a' to be the same. That's, when the first 'b2
in 'a' is D, then the last 'b' should be D. The same is true for E.

To provide this, do I have to write two alternatives for 'a' (that is, a: D
c D | E c E) or is there an easier way to make ANTLR to provide this
condition? I have to use explicit version (righthandside) of rule 'a' in
many rules, so it would be good if I have a chance to write 'a' in one
alternative.

-- 
-safiye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090825/2a8760c9/attachment.html 


More information about the antlr-interest mailing list