Sample Railroad Diagram

The following diagram illustrates a variant grammar that parses the following English sentence:

"The quick brown fox jumps over the lazy dog."


Description of sample.gif follows
Description of the illustration sample.gif

Keywords and variables on the main line (with arrow markings) are required; optional grammar is recessed (lower than the main line). A vertical stack of words represents alternatives. Bold words indicate defaults when no word is chosen.

Valid sentences parse-able by the example grammar may include:

  • The fox jumps over the dog. Bold letters indicate a default value when no option is entered; therefore, entry of this statement would be interpreted as The brown fox jumps over the dog.

  • The quick brown fox jumps over the dog.

  • The red fox jumps over the lazy cat.

  • The quick brown fox jumps onto the tired elephant.