ErlEsy is a simple graphing tool for Erlang. It allows for automatic generation of state machine diagrams out of Erlang source files. It works by parsing an .erl source file and building a digraph out of it. The digraph can be then transformed into any format that will allow for its graphical representation.
ErlEsy can be build by rebar3
rebar3 escriptize
You can also use the makefile, with these directives:
make compile
- fetches deps and compiles erlesymake shell
- starts an erlesy shellmake escriptize
- compiles to escript
_build/default/bin/erlesy ErlFile IncludeFiles*
ErlFile
should be a path to the .erl file you want to graph.
IncludeFiles*
is a list of paths towards include files.
To run ErlEsy open a shell with
make shell
Then you can create any file by using
-spec create_graph(string(), [string()], dot) -> ok.
otp_parser:create_graph(FileName, IncludeFiles, Mode).
- FileName should be a path to the .erl file you want to graph
- IncludeFiles is a list of paths towards include files
- Mode is dot
ErlEsy currently supports one form of output, a DOT (.gv) formatted file.
DOT file can be used e.g. at http://www.webgraphviz.com/
Suppose your project structure is
project/src/your_fsm.erl
: The FSM you want to graphproject/include/
: Path to include files used by the fsm
Then execute the following in the erlesy folder:
make shell
otp_parser:create_graph("/absolute_path_to_project/project/src/your_fsm.erl",["/absolute_path_to_project/project/include/"], dot].
This will create a .gv
dot file in the same folder the source is located in.