Take the 2-minute tour ×

I am currently working on a little language, and I'd like to express its grammar more rigorously.

I know about EBNF and it's great to generate parsers (Bison/Yacc), however it's not that easy to visualize. The Wikipedia page on Syntax Diagram points out that one of the success of JSON is due to the display of its grammar as a Rail-Road diagram.

Indeed if one goes to the JSON webpage, one can see nice diagrams, that are easily accessible and (I find) visually attractive, for example:


It easily conveys the structure of an object in JSON, dealing with multiple alternatives and repetitions easily.

A very similar way of expressing the grammar can be found on SQLite (though I prefer the JSON one).


Does anyone know if there was a tool used to generate the JSON diagrams ? (and if so, where I can find it).

The wikipedia page reference some generators but none seem to generate such nice diagrams.

share|improve this question

closed as off-topic by gnat, MichaelT, Michael Kohne, Bart van Ingen Schenau, Robert Harvey Mar 3 at 5:11



add comment

3 Answers

up vote 0 down vote accepted

This question on SO ought to answer your question. It reveals both Crockford's method (spoiler: Visio) and the one for SQLite (custom Tcl), and includes lots of links to other resources.

share|improve this answer
Thanks! I had not search on SO :x –  Matthieu M. Oct 12 '11 at 7:42
add comment

Did you try Dia or Graphviz? They're a bit hard to get started with, but should be able to generate such graphics

share|improve this answer
Those look like generic diagram drawing programs, I wish for either something more specific, or a generic program with a custom module. I only EBNF translation, and I have many other things to do, so a steep learning curve does not cut it :/ –  Matthieu M. Jul 3 '11 at 12:54
I am not aware that that exists. Or whether they could produce something else than a giant mess ;) But Graphviz has a diagram-creating language so you could give it a shot yourself. (Probably not what you wanted to hear, though) –  Kosta Jul 3 '11 at 17:01
add comment

There is a tool to visualize regular expression called regexper. This might already be sufficient for your grammar.

For example the following language:

enter image description here

Could be represented by:

enter image description here

Using the regular expression: (aA*b|)

share|improve this answer
add comment
