[antlr-interest] TreeWalker and AST Transformation

Jens Braeuer mailists at gmx.net
Wed Nov 8 09:51:53 PST 2006


Dear TreeTransformation-Experts,

i've got a problem transforming an AST using a TreeWalker, which i was
unable to solve using google, antlr-doc and the mailinglist archive. :-)

I currently work on a small code generation project, which involves
TreeWalkers to modify a AST (so buildAST is true).

The problem is, that _before_ using the TreeParser a StreamStatement has
_multiple_ children whereas after using the TreeParser only the first
child survives. I used included ASTFrame to look at the results.

Any hints on how i have to modify the grammar so all children are included
in the output-tree ?


TreeWalker grammar snipet:
-----
pr_StepletBody
	:
	#(StepletBody (pr_StreamStatement)*)
	;

pr_StreamStatement
	{ StringBuffer s;}
	:
	#(StreamStatement
		(
			pr_SimpleStreamStatement
			| pr_MultiStreamStatement
			| pr_TimeStreamStatement
			| pr_StreamStatmntWithDefault
			| pr_StepletInvokation

		)
	)
	;
---------


Greetings, Jens Braeuer






More information about the antlr-interest mailing list