Welcome to Railroad Diagram Generator!
This is a tool for creating
syntax diagrams,
also known as railroad diagrams, from
context-free grammars
specified in
EBNF. Syntax diagrams have
been used for decades now, so the concept is well-known, and some tools for diagram generation are
in existence. This one has a focus on web orientation, so its features are
- usage of the W3C's EBNF notation,
- web-scraping of grammars from W3C specifications,
- online editing of grammars,
- diagram presentation in SVG,
-
and it was completely written in web languages
(XQuery,
XHTML,
CSS,
JavaScript).
Due to the use of SVG, a browser capable of handling inline SVG is required. However this applies
to most modern browsers.
Notation
For the original description of the EBNF notation as it is used here, please refer to
"A.1.1 Notation"
in the XQuery recommendation. The
XML recommendation contains a
similar section, "6 Notation".
Below is a self-describing grammar for the EBNF notation.
For viewing railroad diagrams of this very grammar, you could either
- select "EBNF Notation" from the "Get Grammar" tab, or
- copy and paste the above grammar to the "Edit Grammar" tab
and then proceed to the "View Diagram" tab. Or just click
here for a shortcut.