[antlr-interest] How to get rid of useless nodes in AST?

Sam Harwell sam at tunnelvisionlabs.com
Fri Nov 16 05:45:07 PST 2012


Hi Jarrod,

I added a comment to the answer you posted at StackOverflow. The method you call the "alternate" method is the only proper solution posted on the entire page. When the AST operators (used for the "alternate" method) are able to produce the tree shape you want, then using rewrites shouldn't even cross your mind as an option. Find a way to make it work for you, perhaps by altering the display code to produce the labels you want instead of showing the operator text itself.

--
Sam Harwell
Owner, Lead Developer
http://tunnelvisionlabs.com

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jarrod Roberson
Sent: Thursday, November 15, 2012 10:26 PM
To: Antlr Interest
Subject: [antlr-interest] How to get rid of useless nodes in AST?

I asked this question on stackoverflow.com, it has many details and
graphics depicting what I am trying to do.

http://stackoverflow.com/questions/13409927/how-to-get-rid-of-useless-nodes-from-this-ast-tree

Can anyone help me get rid of these intermediate nodes?

-- 
Jarrod Roberson

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address




More information about the antlr-interest mailing list