Hi everybody, I am trying to make a simple compiler for a language that does simple arithmetic expression and read/write operations. I have a parser generating an AST. Now I would like to walk that AST an alter/rewrite it by removing superflous subtrees.
e.g: When I get a subtree for an addition saying: ^(ADD 0 expr ) or ^(ADD expr 0) the subtree should be replaced by just expr The same applies to multiplications with one or zero: remove the subtree and replace it by one of the operands or zero. How could I achieve this with a tree-grammar? kind regards Tilman Bender Student des Software Engineering Hochschule Heilbronn [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
