This project is a interpreter that can create and execute DCR graphs with templates. The main goal of this prototype is to validate the usability and the expressiveness of the templates in DCR graphs and to see how it can be used in various scenarios.
To start the interpreter, run the following command in the terminal:
$ dune exec tmpl_dcr -- <filename.tdcr>Where <filename> is the name of the file that contains the DCR graph with templates. You can see some examples in the examples directory of the project to see how to write a DCR graph with templates.
Note: The file extension must be .tdcr in order to be recognized by the program.
After running the command, you should see the following prompt.
> From this prompt, you can run the commands specified in the Commands section.
The interpreter accepts the following arguments:
--help or -h: Show the help message and exit.--version or -v: Show the version of the interpreter and exit.--log <value> or -l <value>: Set the log level. The value can be one of the following: debug, info, warn, error, success. If not specified, the interpreter does not log anything.The interpreter accepts the following commands:
help: Show the available commands and their descriptions.exit: Exit the interpreter, returning with the exit code 0.view: View the current state of the DCR graph.
Flag | Description |
|---|---|
| View the disabled events. |
| View the relations between the events. |
| View the templates that are available in the program. |
| View the values of the events. |
execute <event_id> <value>: Execute the event with the given event_id and the given expr as the input. The event_id is the id of the event that you want to execute. The value is the value that you want to pass to the event.export <filename1> <filename2> ... <filenameN>: Export the current state of the DCR graph to the given files.
Flag | Description |
|---|---|
| Export the program in the given mode |
The interpreter is implemented in OCaml and uses the Dune build system. The entry module is Cli.
The project is organized into the following modules:
Module | Description |
|---|---|
Handles the command-line interface, including parsing arguments and commands. | |
Provides the main API for interacting with DCR graphs, including initialization, execution, and viewing. | |
Defines the abstract syntax tree of a templated DCR Graph. | |
Implements the type-checking logic for events and expressions. | |
Implements the Read-Eval-Print Loop (REPL) for interactive usage. | |
Contains utility functions and helpers used across the project. |