it's awesome.  you can match or rewrite any subtree just by giving the  
pattern.  the strategy for traversal and how many rules / which rules  
to apply is totally under coder control.  Useful transformation rules  
can be put into libraries for importing :)

Anyhoo, in my DEV branch not main, i've been doing this:

* CommonTreeNodeStream -> BufferedTreeNodeStream.  Now,
  CommonTreeNodeStream is completely unbuffered unless you are
  backtracking.  No longer making a list of all nodes before tree  
parsing.

* Added tree grammar filter=true mode.

  Altered templates:
        Java.stg: added filterMode to genericParser and treeParser.
        This required a change to ANTLRCore.sti
        Defined a default parameter in treeParser to set the superclass
        to TreeFilter for tree grammar with filter=true. It sets
        superclass to TreeRewriter if filter=true and output=AST.
  Other them that, I only had to change ANTLR itself a little bit.
  Made filter mode valid for tree grammars and have it automatically set
  the necessary elements: @synpredgate, backtrack=true, rewrite=true
  (if output=AST).  Added error message for detecting conflicting
  options.

* Added misc.FastQueue and TestFastQueue:
  A queue that can dequeue and get(i) in O(1) and grow arbitrarily  
large.
  A linked list is fast at dequeue but slow at get(i).  An array is
  the reverse.  This is O(1) for both operations.

* Added tree.TreeIterator, a generator that walks a doubly linked tree.
  The nodes must know what index they are. It's an Iterator but
  remove() is not supported. Returns navigation nodes always:
  UP, DOWN, EOF.

* Added misc.LookaheadStream: A lookahead queue that knows how
  to mark/release locations in the buffer for backtracking purposes.
  I hope to use for both tree nodes and tokens.  Just implement
  nextElement() to say how to get next node or token.

* Added tree.UnBufferedTreeNodeStream to make tree parsing of subtrees
  faster.  It only walks tree as required by LT/consume operations.

I've updated your templates to conform to new genericParser and  
treeParser arg list:

edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
ActionScript/ActionScript.stg#3
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
C/C.stg#9
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
CPP/CPP.stg#3
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
CSharp/CSharp.stg#5
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
CSharp2/CSharp2.stg#3
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
Delphi/Delphi.stg#2
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
Java/Java.stg#10
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
JavaScript/JavaScript.stg#2
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
ObjC/ObjC.stg#5
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
Perl5/Perl5.stg#3
edit //depot/code/antlr/dev/parrt.dev/src/org/antlr/codegen/templates/ 
Python/Python.stg#6

After another point release or two, we can start working towards 3.2  
and I'll merge into main line.

Ter

_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org:8080/mailman/listinfo/antlr-dev

Reply via email to