Syntax diagrams
A syntax diagram describes the context-free, abstract grammar of a product function.
A syntax diagram for example describes a language instruction, the structure of a configuration file, or the options of command-line tool.
The following rules are used in a syntax diagram:
- Invariable syntax elements (keywords) are written in
fixed font
. - Language keywords are in uppercase, like
INPUT BY NAME
. - Variable syntax elements are written in italics.
- Wildcard characters are used to indicate syntax elements that can either repeat, be mandatory or optional.
Wildcard characters notation | Description | Example |
---|---|---|
|
Square brackets indicate an optional element in the syntax. |
|
|
Square brackets with pipe separator indicate an optional element to be selected from the list. |
|
|
Curly brackets with pipe separator indicate a mandatory element to be selected from the list. |
|
element |
A sign made of square brackets with three dots indicate that the previous element can appear more than once. |
|
element element element element |
A sign made of square brackets including a separator character (comma, colon, semi-colon, pipe) followed by three dots indicate that the previous element can appear more than once, and must be separated by the specified character. |
|
Example (dummy language
instruction):
CREATE [
PRIVATE |
PUBLIC ]
SHAPE object-name
WITH integer-expression {
ROWS |
COLUMNS }
[
USING option [
,...]
]
In
this syntax diagram:- The
CREATE
keyword can be followed byPRIVATE
orPUBLIC
keywords, but these are not mandatory (square brackets are used) - object-name is a variable syntax element, to define the name of the object to be created.
- integer-expression indicates an expression that must evaluate to an whole number.
- The integer-expression must be followed by the mandatory
ROWS
orCOLUMNS
keyword (curly braces are used) - The whole
USING
clause is not required (square braces are used) - If the
USING
clause is specified, it must be followed by a comma-separated list of option elements.
CREATE SHAPE shape1
WITH 5 ROWS
CREATE PRIVATE SHAPE shape2
WITH 25 COLUMNS
USING fragmentation, autoload