Skip to content

Latest commit

 

History

History
74 lines (44 loc) · 2.36 KB

README.rst

File metadata and controls

74 lines (44 loc) · 2.36 KB

DrawGrammar is a tool to draw railroad diagrams of an EBNF grammar. It is available as an interactive demo and as a command-line tool.

It's licensed under the MIT license. It's available on OPAM. Its source code is on GitHub.

Questions? Remarks? Bugs? Want to contribute? Open an issue!

image

image

image

image

Quick start

The simplest way is to use the interactive demo, load examples and play with the settings.

If you want to use it locally as a command-line tool, install it from OPAM:

$ opam install DrawGrammar

Then create a my_grammar.iso-ebnf file containing, for example:

expr = term, { ( '+' | '-' ) , term };

term = { factor, ( '*' | '/' ) }, factor;

factor = integer | '(', expr, ')';

integer = [ '-' ], digit, { digit };

digit = '0' | '1' | '...' | '9';

And draw it:

$ draw_grammar my_grammar.iso-ebnf

If you want to tweak settings, the help is accessible using:

$ draw_grammar --help

Development version

If you want to use the development version on the command line, you can:

$ opam pin add General --dev-repo
$ opam pin add DrawGrammar --dev-repo

This always matches the version used in the interactive demo.