1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-04 23:39:57 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/concepts/Railroad Diagrams.tid

21 lines
1.1 KiB
Plaintext
Raw Normal View History

created: 20150105133800000
2021-11-18 08:58:41 +00:00
modified: 20211117212441252
tags: Concepts
title: Railroad Diagrams
<<.def "Railroad diagrams">>, sometimes called <<.def "syntax diagrams">>, are a visual way of explaining the syntax rules of a computer language. Reading one is like reading a public transport map.
Each diagram starts on the left and ends on the right. Simply follow any line from the startpoint to the endpoint. All the alternative lines are equally valid. A line will sometimes jump over an item that is optional, or loop back to indicate that an item can be repeated.
<$railroad text="""
start [:optional] {repeated +","} end
"""/>
2015-01-11 19:09:35 +00:00
In the example above, a comma appears between each occurrence of the `repeated` item. The comma path runs from right to left, and can only be reached by first passing through `repeated`.
Characters in round boxes are literal, i.e. they denote themselves. A name in a rectangular box denotes a further railroad diagram.
The TW [[Filter Syntax]] documentation makes extensive use of railroad diagrams.
The railroad diagrams in ~TiddlyWiki's documentation are generated with the [[Railroad Plugin]].