Visualize abstract syntax trees of methods, declarations, expressions, etc.

irahorecka, updated 🕥 2023-02-11 02:31:09

astree

Visualize abstract syntax trees of methods, declarations, expressions, etc.

astree.py combines the Python ast module with pydot_ng to draw abstract syntax trees specified in DOT language scripts. An abstract syntax tree is a tree representation of the abstract syntactic structure of source code written in a programming language (e.g. Python).


Jumpstart -- running the program: 1) Clone repository 2) $ pip install -r requirements.txt
3) $ python astree.py

Input modules, methods, declarations, statements, expressions, etc.
View video example here.

For example, let's look at the requests.get method:
>>> Input a method name, expression, etc.:
requests.get

AST visualize requests.get


Note: please report bugs to issues.

Issues

Feature Request: Parse A File Or Entier Folder

opened on 2021-04-21 15:38:38 by anitsh

As a command line user or module implementer, It would be great if to be able to pass a file or folder as an argument and generate a dot file.

For example, https://github.com/Persper/js-callgraph allows this feature but for js projects. js-callgraph --cg input-scripts/simple-scripts/functioncall-arithmetic.js --output filename.json

astree syntax-trees abstract-syntax-tree graphviz-dot pydot