# erlesy

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.

## Dependencies

* `OTP 19`
* `rebar3` accessible via path

## Building

### rebar3

ErlEsy can be build by rebar3

`rebar3 get-deps`
`rebar3 compile`

### make

You can also use the makefile, with these directives:
`make compile` - fetches deps and compiles erlesy
`make shell` - starts a erlesy shell

## Running 

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

## Output and graphing

ErlEsy currently supports one form of output, a [DOT (.gv)]( formatted file.

### DOT

DOT file can be used e.g. at

## Example

Suppose your project structure is

* `project/src/your_fsm.erl`: The FSM you want to graph
* `project/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.