[antlr-interest] FancyAST class

atripp54321 atripp at comcast.net
Thu Jul 17 10:18:48 PDT 2003


I have a FancyAST class that's a subclass of ANTLR's 
CommonAST class. It has many functions to make AST tree manipulation
easier:

  * Each AST knows who its parent is: getParent()
  * Support for comments: addComment(), addComments(), getComments(),
setComments(), findAllComments()
  * Ability to clone an entire tree: cloneAST()
  * Some useful methods: getLastChild(), getLastSibling(),
getChildCount(), getChildNumber(), addChild()
  * Useful methods to insert, remove, and replace and AST in the tree:
insert(), remove(), replace()
  * Get a child with a given text, type, or both: findID(),
findType(), find()
  * Search entire AST tree by text or type: findID(), findType()
  * Display AST tree structure: showTree()
  * Search for a ancestor with a given type: findParentWithType()

Some of these methods may overlap with functionality provided 
by CommonAST. But I was kinda suprised that CommonAST didn't
include these methods.  Seems like you'd need these things to
do any real work with ASTs.

Anyone interested in this? If so, I'll add it to the "File Sharing"
section of antlr.org.

Andy


 

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




More information about the antlr-interest mailing list