[antlr-interest] How do you include a constant string in an AST?

Chris McConnell chrimc at microsoft.com
Sat May 26 10:07:31 PDT 2012

I have a rule like this:

linkItemID: linkPredicate '(' PROPERTIES ',' string ')' -> ^(linkPredicate PROPERTIES ^(Eql 'ItemID' string))

What I want is to rewrite the syntax into a specific form that involves a constant that is not matched on the left side.  So far I have not been able to figure out how to do this.  I know I could make it a token constant like Eql, but I want this form since it is what my generator expectes.  I have the ANTLR book and I've read through it several times... :)


More information about the antlr-interest mailing list