Difference between revisions of "Prokee Syntax Notation"
Jump to navigation
Jump to search
| Line 6: | Line 6: | ||
* There is no concatenation operator. Successive symbols are written one after the other (without a comma or space). | * There is no concatenation operator. Successive symbols are written one after the other (without a comma or space). | ||
* There is no termination symbol ';' (or. '.'). The syntax rules are usually specified individually as separate string literals, which means that no termination symbol is necessary. | * There is no termination symbol ';' (or. '.'). The syntax rules are usually specified individually as separate string literals, which means that no termination symbol is necessary. | ||
| − | * For optional repetitions, "{}" is omitted. Instead, three dots "..." are used to indicate optional continuation. Since repetition is always optional, the three points are always enclosed in square brackets (see examples below). | + | * For optional repetitions, "{ }" is omitted. Instead, three dots "..." are used to indicate optional continuation. Since repetition is always optional, the three points are always enclosed in square brackets (see examples below). |
* Any Unicode characters can be used as terminal symbols. (Preferred encoding is UTF-8.) | * Any Unicode characters can be used as terminal symbols. (Preferred encoding is UTF-8.) | ||
* Spaces are not treated differently than other terminal symbols. | * Spaces are not treated differently than other terminal symbols. | ||
* If non-terminal symbols are to be used as terminal symbols, then a backslash can be prefixed to this symbol. | * If non-terminal symbols are to be used as terminal symbols, then a backslash can be prefixed to this symbol. | ||
| − | * As in EBNF, grouping is done with "()" and optional parts are written within brackets "[]". And '|' is used for alternatives. | + | * As in EBNF, grouping is done with "( )" and optional parts are written within brackets "[ ]". And '|' is used for alternatives. |
* Within angle brackets "<>", additional syntax specifications can be specified depending on the application. | * Within angle brackets "<>", additional syntax specifications can be specified depending on the application. | ||
Revision as of 23:08, 6 May 2019
The Prokee Syntax Notation is a notation for syntax rules used by some prokee modules.
Characteristics of the syntax notation:
- Terminal symbols are written without quotation marks.
- There is no concatenation operator. Successive symbols are written one after the other (without a comma or space).
- There is no termination symbol ';' (or. '.'). The syntax rules are usually specified individually as separate string literals, which means that no termination symbol is necessary.
- For optional repetitions, "{ }" is omitted. Instead, three dots "..." are used to indicate optional continuation. Since repetition is always optional, the three points are always enclosed in square brackets (see examples below).
- Any Unicode characters can be used as terminal symbols. (Preferred encoding is UTF-8.)
- Spaces are not treated differently than other terminal symbols.
- If non-terminal symbols are to be used as terminal symbols, then a backslash can be prefixed to this symbol.
- As in EBNF, grouping is done with "( )" and optional parts are written within brackets "[ ]". And '|' is used for alternatives.
- Within angle brackets "<>", additional syntax specifications can be specified depending on the application.
| EBNF | Prokee Notation | Remarks | |
|---|---|---|---|
| Terminal symbols | 'a' |
a |
No single or double quotes |
| Termination symbol | 'a'; |
a |
No termination symbol |
| Concatenation | 'a', 'b', 'c' |
abc |
No spaces, no concatenation operator |
| Alternatives with '|' | 'a', 'b' | 'c' |
ab|c |
|
| Grouping | 'a', ( 'b' | 'c' ) |
a(b|c)
| |
| Optional parts | 'a', [ 'b' ] , 'c' |
a[b]c
| |
| Optional repetition, example 1 | 'a', { 'b' }, 'c' |
a[b[...]]c |
Optional repetition of the element left of [...]
|
| Optional repetition, example 2 | 'a', 'b', { 'b' }, 'c' |
ab[...]c
| |
| Optional repetition, example 3 | 'a', 'b', { 'a', 'b' }, 'c' |
(ab)[...]c
| |
| Optional repetition (with separator) | 'x', { ',', 'x' } |
x[,...] |
equal to x[(,x)[...]]
|