[antlr-interest] Not generating parts of AST (argh!)

Paul J. Lucas pauljlucas at mac.com
Mon Oct 25 10:35:06 PDT 2004


On Sun, 24 Oct 2004, Monty Zukowski wrote:

> There are language specific ways to manually ^ a node, but your code 
> actually looks cleaner.

	IMHO, '^' should be allowed on non-terminals.  Terrence: any
	reason it isn't?

> On second thought, how about this:
> 
> 		comparisonExpr
> 		    : rangeExpr
> 		      (co:comparisonOp! rangeExpr { ##=#(co,##); })?
> 		    ;

	:-O

	Where, if anywhere, is "##" documented?

> The following would work for sure:
> 
> 		comparisonExpr
> 		    : re1:rangeExpr
> 		      (co:comparisonOp! re2:rangeExpr! { #comparisonExpr = #(co, re1, 
> re2); })?
> 		    ;

	Yes, it does; thanks.

	- Paul

	P.S.: After getting more into it, the tree-construction syntax
	is seeming more and more arcane.  One thing I don't understand
	is why a rule as a whole ought to have an optional '!' to
	suppress insertion into the tree.  The ANTLR compiler scans the
	user-code anyway to look for #ruleName -- if it see's one, then
	the '!' on the rule is implied.  No?



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list