JuliaTeX / TreeView.jl

Draw Julia syntax trees as a graph
Other
82 stars 15 forks source link

TreeView

Build Status codecov

This is a small package to visualize a graph corresponding to an abstract syntax tree (AST) of a Julia expression. It uses the TikzGraphs.jl package to do the visualization.

Usage

The package is designed to be used within the IJulia notebook.

The simplest usage is @tree <EXPRESSION>, where <EXPRESSION> represents any Julia expression, for example

@tree x^2 + y^2

which gives the following output:

example_tree

See this notebook for usage examples.

Installation prerequisites

You will need to have LaTeX installed on your system, and install the pdf2svg utility; see the TikzGraphs.jl documentation for details.

Author

Acknowledements

Financial support is acknowledged from DGAPA-UNAM PAPIME grants PE-105911 and PE-107114, and DGAPA-UNAM PAPIIT grant IN-117214, and from a CONACYT-Mexico sabbatical fellowship. The author thanks Alan Edelman and the Julia group for hospitality during his sabbatical visit.

In particular, he thanks Jiahao Chen, who, when asked if a package like this existed, replied "why don't you write one?".