Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

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 af = new ASTFrame("Tree", t);
af.setVisible(true);

where you need the attached code from Jörg Werner.

  • No labels