[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] [ Search: ]

4.16.4.1 Grammar

Written by Eric Sunshine, sunshine@sunshineco.com.

The syntax for the standard Crystal Space map file is specified using a context-free grammar using a modified BNF (Backus-Naur Form) notation.

Terminal symbols (also known as tokens) are denoted like this, `VERTEX'. Non-terminal symbols are denoted in this fashion, vector. Expressions enclosed within `[' and `]' are optional. When an expression is followed by the notation `...', then the expression may appear zero or more times. Finally, the symbol '|' appearing between expressions indicates selection. Either the expression to the left may be utilized, or the one to the right, but not both. An example follows.

flip => `HEAD' | `TAIL'
wager => `WAGER' flip `(' money [ `,' money ... ] `)'

In this example, a ‘WAGER’ may be followed by either ‘HEAD’ or ‘TAIL’, and then by a parenthesized list of monetary values separated by commas. At least one monetary value must be specified. All subsequent values (including the comma) are optional, as denoted by `[' and `]'. Here are a couple of valid expressions which satisfy the wager production:

 
WAGER HEAD (44)
WAGER TAIL (5, 39, 2)

And here are a few invalid expressions which do not:

 
WAGER HEAD (44,)
WAGER TAIL (,23)
WAGER TAIL ()
WAGER EITHER (81, 15)
WAGER (72, 91)

This document was generated using texi2html 1.76.