[antlr-interest] ASTs: copying info to imaginary nodes
Bill Andersen
andersen at ontologyworks.com
Fri Oct 17 13:31:27 PDT 2008
I have a tree-producing grammar with a production
name
: NAME -> ^(AS_NAME NAME)
;
where NAME is a lexical category and AS_NAME is an imaginary node for
the abstract syntax I want to generate. I know the above doesn't do
what I want, though. What I'd like to do is to set the text of the
generated AS_NAME node to the text of NAME. The book isn't clear on
this case. Anything wrong with the following:
name
: t=NAME -> ^(AS_NAME[$t])
??
Bill Andersen
Ontology Works, Inc. (www.ontologyworks.com)
3600 O'Donnell Street, Suite 600
Baltimore, MD 21224
Office: +1.410.675.1201
Cell: +1.443.858.6444
Fax: +1.410.675.1204
More information about the antlr-interest
mailing list