I have an AST TreeWalker that inherits from TreeParser. In the code below
this class is called MyASTWalker. The language I am creating takes a
string like the following: 7*5+myvariable
myvariable is determined at runtime. The first call to calc() works (this
calculates the answer), however subseqent calls cause an EOF error. I could
recreate MyASTWalker(nodes) for each call to calc(), however that seems
inefficient. Is there a way to accomplish the same thing by calling reset()
on a particular object such as TreeParser or CommonTreeNodeStream?
Also, what is the difference between CommonTreeNodeStream and
BufferedTreeNodeStream?
...
CommonTree commonTree=(CommonTree)ast.getTree();
CommonTreeNodeStream nodes=new CommonTreeNodeStream(commonTree);
MyASTWalker walker=new MyASTWalker(nodes);
for (int i=0;i<100;i++) {
System.out.println(walker.calc());
}
[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