Syntax Diagram / Railroad

> Code - (Programming|Computer) Language > Computer Language - (Compiler|Interpreter) - Language translator

1 - About

A Railroad is a diagram that permits to visualize a grammar. Same as Process - Flow Chart

3 - Structure

A Railroad diagram is made of:

  • a main diagram
  • a set of syntax diagrams.

Each diagram has an entry point and an end point.

  • Terminals are represented by round boxes
  • Non-terminals are represented by square boxes.

It's describes possible paths going through other non-terminals and terminals. To belong to the language, an expression must describe a path starting form the main diagram.


4 - Library

  1. Rail Road Generator: Javascript + svg (not open source)
  2. Railroad-diagrams Javascript + svg
  3. Weltraumschaf/ebnf Php + Image, plugin dokuwiki

5 - Example