Home

 

How to read railroad diagrams

 

Each railroad diagram begins with a double right arrow and ends with a right and left arrow pair. Lines beginning with a single right arrow are continuation lines. You read a railroad diagram from left to right and from top to bottom, following the direction of the arrows.

Other conventions used in railroad diagrams are:

How to read railroad diagrams
Convention Meaning

>>-A--B--C-----------------------------------------------------><

You must specify values A, B, and C. Required values are shown on the main line of a railroad diagram.

>>-+---+-------------------------------------------------------><    '-A-'   

You may specify value A. Optional values are shown below the main line of a railroad diagram.

>>-+-A-+-------------------------------------------------------><    +-B-+       '-C-'   

Values A, B, and C are alternatives, one of which specify.

>>-+---+-------------------------------------------------------><    +-A-+       +-B-+       '-C-'   

Values A, B, and C are alternatives, one of which you might specify.

   .-,-----.       V |    >>---+---+-+---------------------------------------------------><     +-A-+         +-B-+         '-C-'    

You might specify one or more of the values A, B, and C. Any required separator for multiple or repeated values (in this example, the comma (,)) is shown on the arrow.

   .-+---+-.       | '-,-' |       V |    >>---+---+-+---------------------------------------------------><     '-A-'    

You might specify value A multiple times. The separator in this example is optional.

   .-A-.    >>-+---+-------------------------------------------------------><    +-B-+       '-C-'   

Values A, B, and C are alternatives, one of which you might specify. If you specify none of the values shown, the default A (the value shown above the main line) is used.

>>-| Name |---------------------------------------------------->< Name |--A--+---+-----------------------------------------------------|     '-B-'   

The railroad fragment Name is shown separately from the main railroad diagram.
Punctuation and uppercase values Specify exactly as shown.
Lowercase values (for example, name) Supply your own text in place of the name variable.

 

Parent topic:

Syntax diagrams


sc10150_


 

Home