Notation
This section briefly explains the meta syntax constructs used in various parts of the language documentation.
Note
- The notation is not strictly formal, but hopefully descriptive enough to be useful in practice.
- A complete grammar specification may be added later.
The TethysL grammar is defined as a set of rules.
Each rule is defined by a ⟨name⟩ and the corresponding syntax structure,
which itself is defined in terms of other rules and/or
explicit strings that stand for themselves.
For example, the rule for mission is as follows:
⟨mission⟩ syntax
mission ⟨id⟩? {
⟨testCode⟩?
⟨description⟩?
⟨defineArgs⟩?
⟨defineOutput⟩?
⟨break⟩?
⟨timeout⟩?
⟨behavior⟩*
}
A string without enclosing ⟨⟩ characters stands by itself.
In this case, mission is a keyword in TethysL to denote the start of a mission definition.
The ? symbol indicates the element is optional, that is,
it can occur zero or one time.
In a mission, there are various elements that are optional,
for example, ⟨id⟩? indicates that the mission ID is optional.
The * symbol indicates the element can occur zero or more times.
In the example, ⟨behavior⟩* indicates that mission can have zero or more behaviors.
Other notation used in the grammar is grouping of elements using ⟦ ... ⟧.
For example, in the rule for moduleBehavior:
⟨moduleBehavior⟩ syntax
behavior ⟨moduleName⟩:⟨behaviorName⟩ ⟦ id = "someId" ⟧? {
⟨description⟩?
⟨executionMode⟩
⟨break⟩?
⟨timeout⟩?
⟦ ⟨behaviorChoice1⟩ | ⟨behaviorChoice2⟩ ⟧*
}
-
⟦ id = "someId" ⟧?indicates that assigning an ID to the module behavior is optional, and that, if given, must have the syntaxid = "someId". -
⟦ ⟨behaviorChoice1⟩ | ⟨behaviorChoice2⟩ ⟧*indicates that there can be multiple choices for each setting in the body of a module behavior, with each choice being of the alternative forms as indicated by the two rules⟨behaviorChoice1⟩and⟨behaviorChoice2⟩, which are separated with the|operator (which means or).
In general, any
rule name ⟨name⟩ or
grouping ⟦...⟧
that appears in the syntax descriptions:
- is optional if followed by
? - can occur zero or more times if followed by
* - can occur many times (at least one) times if followed by
+ - is required otherwise.