Full example
SYNTAX = SYNTAX RULE, { SYNTAX RULE } ;
SYNTAX RULE
= META IDENTIFIER, '=', DEFINITIONS LIST, ' ;' ;
DEFINITIONS LIST
= SINGLE DEFINITION,
{ '|', SINGLE DEFINITION } ;
SINGLE DEFINITION = TERM, { ',', TERM } ;
TERM = FACTOR, [ '-', EXCEPTION ] ;
EXCEPTION = FACTOR ;
FACTOR = [ INTEGER, '*' ], PRIMARY ;
PRIMARY
= OPTIONAL SEQUENCE | REPEATED SEQUENCE
| SPECIAL SEQUENCE | GROUPED SEQUENCE
| META IDENTIFIER | TERMINAL | EMPTY ;
EMPTY = ;
OPTIONAL SEQUENCE = '[', DEFINITIONS LIST, ']' ;
REPEATED SEQUENCE = '{', DEFINITIONS LIST, '}' ;
GROUPED SEQUENCE = '(', DEFINITIONS LIST, ')' ;
TERMINAL
= "'", CHARACTER - "'",
{ CHARACTER - "'" }, "'"
| '"', CHARACTER - '"',
{ CHARACTER - '"' }, '"' ;
META IDENTIFIER = LETTER, { LETTER | DIGIT } ;
INTEGER = DIGIT, { DIGIT } ;
SPECIAL SEQUENCE = '?', { CHARACTER - '?' }, '?' ;
COMMENT = '(*', { COMMENT SYMBOL }, '*)' ;
COMMENT SYMBOL
= COMMENT | TERMINAL | SPECIAL SEQUENCE
| CHARACTER ;
Full example with alternative syntax
SYNTAX = SYNTAX RULE, (: SYNTAX RULE :).
SYNTAX RULE
= META IDENTIFIER, '=', DEFINITIONS LIST, '.'. (* '.' instead of ';' *)
DEFINITIONS LIST
= SINGLE DEFINITION,
(: '/', SINGLE DEFINITION :).
SINGLE DEFINITION = TERM, (: ',', TERM :).
TERM = FACTOR, (/ '-', EXCEPTION /).
EXCEPTION = FACTOR.
FACTOR = (/ INTEGER, '*' /), PRIMARY.
PRIMARY
= OPTIONAL SEQUENCE / REPEATED SEQUENCE (* / is the same as | *)
/ SPECIAL SEQUENCE / GROUPED SEQUENCE
/ META IDENTIFIER / TERMINAL / EMPTY.
EMPTY = .
OPTIONAL SEQUENCE = '(/', DEFINITIONS LIST, '/)'.
REPEATED SEQUENCE = '(:', DEFINITIONS LIST, ':)'.
GROUPED SEQUENCE = '(', DEFINITIONS LIST, ')'.
TERMINAL
= "'", CHARACTER - "'",
(: CHARACTER - "'" :), "'"
/ '"', CHARACTER - '"',
(: CHARACTER - '"' :), '"'.
META IDENTIFIER = LETTER, (: LETTER / DIGIT :).
INTEGER = DIGIT, (: DIGIT :).
SPECIAL SEQUENCE = '?', (: CHARACTER - '?' :), '?'.
COMMENT = '(*', (: COMMENT SYMBOL :), '*)'.
COMMENT SYMBOL
= COMMENT / TERMINAL / SPECIAL SEQUENCE
/ CHARACTER.