Grammar Notation

This specification uses some additional notation to describe common patterns, such as optional or repeated patterns, or parameterized alterations of the definition of a non‐terminal. This section explains these short‐hand notations and their expanded definitions in the context‐free grammar.

Constraints

A grammar production may specify that certain expansions are not permitted by using the phrase “but not” and then indicating the expansions to be excluded.

For example, the production:

SafeName

Name

SevenCarlinWords

means that the nonterminalSafeNamemay be replaced by any sequence of characters that could replaceNameprovided that the same sequence of characters could not replaceSevenCarlinWords.

A grammar may also list a number of restrictions after “but not” separated by “or”.

For example:

NonBooleanName

Name

true

false

Optionality and Lists

A subscript suffix “Symbolopt” is shorthand for two possible sequences, one including that symbol and one excluding it.

As an example:

Sentence

Noun

Verb

Adverb

opt

is shorthand for

Sentence

Noun

Verb

Noun

Verb

Adverb

A subscript suffix “Symbollist” is shorthand for a list of one or more of that symbol.

As an example:

Book

Cover

Page

list

Cover

is shorthand for

Book

Cover

Page_list

Cover

Page_list

Page

Page_list

Page

Parameterized Grammar Productions

A symbol definition subscript suffix parameter in braces “SymbolParam” is shorthand for two symbol definitions, one appended with that parameter name, the other without. The same subscript suffix on a symbol is shorthand for that variant of the definition. If the parameter starts with “?”, that form of the symbol is used if in a symbol definition with the same parameter. Some possible sequences can be included or excluded conditionally when respectively prefixed with “[+Param]” and “[~Param]”.

As an example:

Example

Param

A

B

Param

C

Param

Param

D

Param

E

is shorthand for

Example

A

B_param

C

E

Example_param

A

B_param

C_param

D

results matching ""

    No results matching ""