sun::debug::AstDotGenerator
class · Source (opens in a new tab)
class sun::debug::AstDotGeneratorGenerates a Graphviz DOT graph from an AST tree.
Usage: AstDotGenerator gen; std::string dot = gen.generate(astRoot);
Public Functions
generate
public · function · Source (opens in a new tab)
std::string sun::debug::AstDotGenerator::generate(const ExprAST *root)Generate DOT representation of the entire AST.
Related: ExprAST
Private Functions
escapeLabel
private · function · static · Source (opens in a new tab)
std::string sun::debug::AstDotGenerator::escapeLabel(const std::string &s)Escape special characters for DOT labels.
getNodeLabel
private · function · Source (opens in a new tab)
std::string sun::debug::AstDotGenerator::getNodeLabel(const ExprAST *node)Get a human-readable label for a node.
Related: ExprAST
visitChildren
private · function · Source (opens in a new tab)
void sun::debug::AstDotGenerator::visitChildren(const ExprAST *node, int parentId)Visit children of a node and emit edges.
Related: ExprAST
visitNode
private · function · Source (opens in a new tab)
int sun::debug::AstDotGenerator::visitNode(const ExprAST *node)Visit a node, assign it an ID, emit its label, and return its ID.
Related: ExprAST
Private Fields
nodeCounter
private · variable · Source (opens in a new tab)
int sun::debug::AstDotGenerator::nodeCounter = 0No documentation comment.
out
private · variable · Source (opens in a new tab)
std::stringstream sun::debug::AstDotGenerator::outNo documentation comment.