ANTLR, ANother Tool for Language Recognition, is a Java-based tree parser generator that allows users to define grammars and AST-parsers for specific languages. For debugging purposes it is possible to print ANTLR's representation of a AST in a string representation. For my purposes, this string representation soon got too big, so I decided to us ANTLR to write a parser for these strings and translate them into a DOT file that can be used to visualize the tree with Graphviz. |
You need the following tools for running Tree2Dot:
ANTLR grammar: |
Tree.g |
Tree2Dot python tool: |
Tree2Dot |