What is a Railroad Diagram? known as Syntax diagram

Compiler

About

A Railroad is a diagram that permits to visualize a grammar (Same as a process flow)

Example

With RRDiagram and BNF syntax of H2 select SQL

<pre class="BNF">
'SELECT' [ 'TOP' term ] [ 'DISTINCT' | 'ALL' ] selectExpression {',' selectExpression} \
'FROM' tableExpression {',' tableExpression} [ 'WHERE' expression ] \
[ 'GROUP BY' expression {',' expression} ] [ 'HAVING' expression ] \
[ ( 'UNION' [ 'ALL' ] | 'MINUS' | 'EXCEPT' | 'INTERSECT' ) select ] [ 'ORDER BY' order {',' order} ] \
[ 'LIMIT' expression [ 'OFFSET' expression ] [ 'SAMPLE_SIZE' rowCountInt ] ] \
[ 'FOR UPDATE' ];
</pre>

Structure

A Railroad diagram is made of:

  • a main diagram
  • a set of syntax diagrams.

Each diagram has an entry point and an endpoint.

It describes possible paths going through :

To belong to the language, an expression must describe a path starting from the main diagram.

Library

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

Others: https://npm.io/search/keyword:railroad

Example





Discover More
Etag - An unique identifier for a HTTP resource

The ETag HTTP response header is an identifier for a specific version of a resource. A etag comparison determines whether two representations of a resource are the same and is therefore similar to a hash...
Alter Table Railroad Sqlite
How to alter a table structure with SQLite?

The alter statement of SQLite is pretty limited. This page shows you: what you can do and can't do with an alter table statement how to modify the structure of your table You can: rename a table...
Grammar Different Structural Trees For The Same Expression
Language - (Grammar | Syntax | Lexicon)

Grammar in the context of a compiler. Ie how to define it. grammar section In processing computer languages, semantic processing generally comes after syntactic processing, but in some cases semantic...
Regexp
Regular Expression - Visualization

A regular expression is visualized via a railroad diagram. language grammar This library implement specifically a translation from a regular expression to a railroad diagram klorenz/atom-regex-railroad-diagrams...
What is the mail date string format (rfc2822)

What is the internet mail date string format (rfc2822)?



Share this page:
Follow us:
Task Runner