[antlr-interest] How to implement implicit concatenation operator (for Regular Expressions)

Manuel Kirschner kirschner at inf.unibz.it
Mon Oct 2 03:15:12 PDT 2006


Hello,
I'm new to antlr, so please excuse the possibly trivial question.
For parsing Regular Expressions (REs), I need to implement "implicit"
concatenation by juxtaposition. So far, my grammar parses REs
successfully, as long as I insert some explicit concatenation operator
(CONCAT) into the input string. The relevant parsing rule:

basicRE : simpleRE ((CONCAT^) simpleRE)*;

How do I get antlr to introduce the CONCAT operator node into the AST
between every two simpleRE nodes, even though CONCAT has no character
representation in the input text?

Thanks for your hints!


More information about the antlr-interest mailing list