[antlr-interest] Re: Building trees with the correct associativity

Paul J. Lucas pauljlucas at mac.com
Wed Dec 1 18:45:29 PST 2004


On Thu, 2 Dec 2004, lgcraymer wrote:

> addExpr:
>     :
>     mulExpr (addOp mulExpr)*
>     ;

	This elides the tree-building code, a la:

		## = #([ADD_EXPR,"ADD_EXPR", ao, e1 e2);

	If I add that in inside the ()*, the ## gets its value
	overwritten (as Terence noted and I subsequently corrected).

> addExpr
>     :
>     mulExpr (addOp addExpr)*
>     ;

	This is what I actually have now (as I corrected myself in a
	previous e-mail).  This doesn't work.

	I want an ADD_EXPR to be present in the tree only if an
	expression actually contains an addOp thus prodicing "compact"
	trees without lots of useless intervening nodes.

	- Paul



 
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