[antlr-interest] AST transforms - propagation of semantic information
Bill Andersen
andersen at ontologyworks.com
Thu Nov 13 12:02:01 PST 2008
Folks,
Here's a fragment of a AST transformation grammar I'm working on
foo
: ^(IMPL ^(OR x+=form+) y=form)
-> ^(AND ^(AS_IMPL $x $y)+)
;
I want to keep certain semantic information on tree nodes. Figured
out already how to do this with custom node classes. What I want, in
the example of the rule above, is for the semantic information on the
root node (IMPL) to be automatically propagated to the output root
node (AND). Of course I can write actions in each such production to
do this, but I have a whole lot of productions like this and writing
all those actions is a maintenance problem.
Is there some way to do this pervasively, perhaps with a custom
TreeAdaptor? Thanks in advance.
bill
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