[antlr-interest] ANTLR 3 rewrite rule syntax

Shmuel Siegel ssiegel at finjan.com
Mon Dec 4 05:56:45 PST 2006


To my surprise, I am coming to like the rewrite rules better than the
grammar markups; more power and better separation between grammar and
output.  I do have some syntax questions.

 

Consider 

rule : A? B (id+)=C*

 

I know that I can write -> A? MYTOKEN[$B] $id*

 

But how can I make private tokens from "A" and "C". Ultimately "C" can
be handled by a subrule but how do I issue a conditional token in my
rewrite. MYTOKEN[$A?] and MYTOKEN[$A]? don't seem to work.

 

Shmuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061204/336c47f1/attachment.html 


More information about the antlr-interest mailing list