Syntax diagram
Syntax diagrams (or railroad diagrams) are a way to represent a context-free grammar.[src] They represent a graphical alternative to Backus–Naur form, EBNF, Augmented Backus–Naur form, and other text-based grammars as metalanguages.[src] Early books using syntax diagrams include the "Pascal User Manual" written by Niklaus Wirth (diagrams start at page 47) and the Burroughs CANDE Manual.[src] In the compilation field, textual representations like BNF or its variants are usually preferred.[src] BNF is text-based, and used by compiler writers and parser generators.[src] Railroad diagrams are visual, and may be more readily understood by laypeople, sometimes incorporated into graphic design.[src] The canonical source defining the JSON data interchange format provides yet another example of a popular modern usage of these diagrams.[src]
Syntax diagrams (or railroad diagrams) are a way to represent a context-free grammar.[src] They represent a graphical alternative to Backus–Naur form, EBNF, Augmented Backus–Naur form, and other text-based grammars as metalanguages.[src] Early books using syntax diagrams include the "Pascal User Manual" written by Niklaus Wirth (diagrams start at page 47) and the Burroughs CANDE Manual.[src] In the compilation field, textual representations like BNF or its variants are usually preferred.[src] BNF is text-based, and used by compiler writers and parser generators.[src] Railroad diagrams are visual, and may be more readily understood by laypeople, sometimes incorporated into graphic design.[src] The canonical source defining the JSON data interchange format provides yet another example of a popular modern usage of these diagrams.[src] ::= | "+" ::= | "*" ::= | | "(" ")" ::= "x" | "y" | "z" ::= | ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" EBNF: expression = term , [ "+" , expression ]; term = factor , [ "*" , term ]; factor = constant | variable | "(" , expression , ")"; variable = "x" | "y" | "z"; constant = digit , { constant }; digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; ABNF: expression = term ["+" expression] term = factor ["*" term] factor = constant / variable / "(" expression ")" variable = "x" / "y" / "z" constant = 1*digit DIGIT = "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" ABNF also supports ranges, e.g.[src] , but it is not used here for consistency with the other examples.[src] Red (programming language) Parse Dialect: Red [Title: "Parse Dialect"] expression: [term opt ["+" expression]] term: [factor opt ["*" term]] factor: [constant | variable | "(" expression ")"] variable: ["x" | "y" | "z"] constant: [some digit] digit: ["0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"] This format also supports ranges, e.g.[src] , but it is not used here for consistency with the other examples.[src] One possible syntax diagram for the example grammars is below.[src] While the syntax for the text-based grammars differs, the syntax diagram for all of them can be the same because it is a metalanguage.[src] ==See also== Recursive transition network Extended Backus–Naur form (EBNF) ==References== Note: the first link is sometimes blocked by the server outside of its domain, but it is available on archive.org.[src] The file was also mirrored at standardpascal.org.[src] ==External links== JSON website including syntax diagrams Generator from EBNF From EBNF to a postscript file with the diagrams EBNF Parser & Renderer SQLite syntax diagram generator for SQL Online Railroad Diagram Generator Augmented Syntax Diagram (ASD) grammars (ASD) Augmented Syntax Diagram Application Demo Site SRFB Syntax Diagram representation by Function Basis + svg generation[src]
23 sentences · 23 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Syntax diagram." encyclopegia.org, 2025, https://encyclopegia.org/wiki/syntax-diagram. Accessed 02 December 2026.
Chicago
"Syntax diagram." encyclopegia.org. Accessed December 2, 2026. https://encyclopegia.org/wiki/syntax-diagram.
APA
encyclopegia.org. (2025). Syntax diagram. Retrieved December 2, 2026, from https://encyclopegia.org/wiki/syntax-diagram
Accessed December 2, 2026 · CC BY-SA 4.0 · citation page · JSON