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

All content with label faq_trees.
Related Labels: faq_treeparsing, faq_lexing

How do I display ASTs graphically (ANTLR 3)
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? (ANTLR 3)
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? (ANTLR 3)
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? (ANTLR 3)
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? (ANTLR 3)
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