[antlr-interest] tree interpreters and node streams
Terence Parr
parrt at cs.usfca.edu
Fri Dec 22 12:54:17 PST 2006
Hi,
Just made some big changes in the tree node stream stuff to support
interpreters.The issue was that the current tree nodes stream did not
buffer any node pointers so it was not really suited for
interpreters, which need to jump around in the treenode stream quite
a bit. When building the buffered version, I noticed that it was much
simpler and faster than the unbuffered version so I have made it the
common treenode stream. It has extra methods for push and pop of
indexes so that you can make an interpreter that jumps around. I've
re-factored the unit tests for treenode stream and added a few tests
for the push and pop.
Also, importantly, made CommonTreeNodeStream work with any tree node
type. It assumes object now and uses an adapter.
* New CommonTreeNodeStream buffers all nodes in stream for fast jumping
around. It now has push/pop methods to invoke other locations in
the stream for building interpreters.
* Moved CommonTreeNodeStream to UnBufferedTreeNodeStream and removed
Iterator implementation. moved toNodesOnlyString() to
TestTreeNodeStream
* [BREAKS ANY TREE IMPLEMENTATION]
made CommonTreeNodeStream work with any tree node type. TreeAdaptor
now implements isNil so must add; trivial, but does break back
compatibility.
Okay, back to writing the book. Finished tree construction, tree
parsing chapters. Now templates, error reporting, intro and I'm done!
Ter
More information about the antlr-interest
mailing list