jacquev6 / DrawGrammar

Draw railroad diagrams of EBNF grammars. In browser and on command line

Home Page:http://jacquev6.github.io/DrawGrammar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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!

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.

About

Draw railroad diagrams of EBNF grammars. In browser and on command line

http://jacquev6.github.io/DrawGrammar


Languages

Language:OCaml 88.0%Language:Shell 7.7%Language:HTML 2.6%Language:Python 1.8%