The following syntactic metasymbols are used (extended BNF):
Syntax | Description |
---|---|
[ ] | Optional |
{ } | Repeat zero or more times |
| | Alternatives |
"" | The is treated as a single token (no white-space between any characters) |
The following lexical units are defined:
S-CHAR is any member of the Unicode character set (https://unicode.org; see section 13.4 for storing as UTF-8 on files) except double-quote ‘”’, and backslash ‘\’.
For identifiers the redundant escapes (‘\?’ and ‘\""’) are the same as the corresponding non-escaped variants (‘?’ and ’""’). The single quotes are part of an identifier. For example, the identifiers 'x' and x are different.
Note:
White-space and comments can be used between separate lexical units and/or symbols, and also separates them. Each lexical unit will consume the maximum number of characters from the input stream. White-space and comments cannot be used inside other lexical units, except for STRING and Q-IDENT where they are treated as part of the STRING or Q-IDENT lexical unit.
Concatenation of string literals requires a binary expression. For example, "a" + "b" evaluates to "ab". There is no support for the C/C++ style of concatenating adjacent string literal tokens (for example, "a" "b" becoming "ab").
Modelica uses the same comment syntax as C++ and Java (i.e., // signals the start of a line comment and /* */ is a multi-line comment); comments may contain any Unicode character. Modelica also has structured comments in the form of annotations and string comments.
In the grammar, keywords of the Modelica language are highlighted with color, for example, equation.
Productions use hyphen as separator both in the grammar and in the text. (Previously the grammar used underscore.)
[Within a description-string the optional tags <HTML> and </HTML> or <html> and </html> define the start and end of content that is HTML encoded.]