tipc
A TIP to LLVM compiler
Public Member Functions | List of all members
ASTVisualizer Class Reference

Constructs a dot graph that can be used to visualize the AST. More...

#include <ASTVisualizer.h>

Public Member Functions

 ASTVisualizer ()
 
 ASTVisualizer (std::ostream &os)
 
void buildGraph (SyntaxTree &tree)
 Construct a dot syntax compliant graph of the AST. More...
 

Detailed Description

Constructs a dot graph that can be used to visualize the AST.

The visualizer traverses the AST in a pre-order fashion, connecting, with edges, children to parents. The output adheres to the dot syntax and can be converted to a format suitable for visualization.

For example, if you run the visualizer and write its output to a file called foo.gv, you can build a png from it using the dot command line interface.

dot -Tpng -o foo.png foo.gv

Constructor & Destructor Documentation

◆ ASTVisualizer() [1/2]

ASTVisualizer::ASTVisualizer ( )
inline

◆ ASTVisualizer() [2/2]

ASTVisualizer::ASTVisualizer ( std::ostream &  os)
inline

Member Function Documentation

◆ buildGraph()

void ASTVisualizer::buildGraph ( SyntaxTree tree)

Construct a dot syntax compliant graph of the AST.

Parameters
treeThe root of the AST.

The documentation for this class was generated from the following files: