Dashboard > ANTLR 3 > Browse Space > Labels > faq_trees
  ANTLR 3 Log In | Sign Up   View a printable version of the current page.  
  Label: faq_trees

Content with label faq_trees in ANTLR 3 (See content from all spaces)
Related Labels: faq_treeparsing, faq_lexing

How do I display ASTs graphically
Instead of using {{t.toStringTree()}}, you can ask ANTLR to generate DOT/graphviz format: DOTTreeGenerator gen = new DOTTreeGenerator(); StringTemplate st = gen.toDOT(t); System.out.println(st); To display in a Swing window (Java target), use this: CommonTree t = (CommonTree) r.getTree(); ASTFrame ...
How can I build a different AST node type for each token type?
same as asking "how do I build heterogeneous trees?" At the moment, the answer is simply to override create(Token) in a TreeAdaptor such as CommonTreeAdaptor and then create different nodes depending on the incoming token type. This does not allow you to build different object types ...
How can I build parse trees not ASTs?
simple. Using the debug event interface, the predefined ParseTreeBuilder class listens for debug events and build a parse tree. Just turn on debug commandline option and then pass in the ParseTreeBuilder listener. Ask the listener for its tree and, using the standard toStringTree() method ...
How do I track whitespace, comments, and other hidden channels during AST construction?
David Holroyd wrote: ANTLR 2 provides CommonHiddenStreamToken et al, which I try to use for layoutpreserving code rewriting. I've just been looking at v3 to see if manipulating ASTs containing hidden tokens has become any ...
Other labels: faq_lexing
Can you explain ANTLR's tree construction facilities?
Introduction ANTLR v3 has moved away from using the ANTLR v2 childsibling trees for the common tree implementation. Instead, ANTLR v3 uses a simple listofchildren approach by default. To avoid locking everyone into the same implementation, ANTLR uses ...
Other labels: faq_treeparsing
Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.1 Build:#806 May 06, 2007) - Bug/feature request - Contact Administrators