Difference between revisions of "Prokee Syntax Notation"
Jump to navigation
Jump to search
(Created page with " <b>Characteristics of the syntax notation:</b> * Terminal symbols are written without quotation marks. * There is no concatenation operator. Successive symbols are written o...") |
|||
| (9 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| + | The '''Prokee Syntax Notation''' is a notation for syntax rules used by some prokee modules. | ||
| − | <b>Characteristics | + | <b>Characteristics:</b> |
* Terminal symbols are written without quotation marks. | * 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 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, like ';' (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 | + | * For optional repetitions, "{ }" (as in EBNF) is omitted. Instead, three dots "..." are used to indicate optional continuation. Since repetition is always optional, the three points are enclosed in square brackets (see examples below). |
| − | * Any | + | * 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. | ||
| + | |||
| + | The following table shows a comparison between EBNF and Prokee Syntax Notation. | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 16: | Line 19: | ||
! !! EBNF !! Prokee Notation !! Remarks | ! !! EBNF !! Prokee Notation !! Remarks | ||
|- | |- | ||
| − | | Terminal symbols || <code>'a'</code> || <code>a</code> || | + | | Terminal symbols || <code>'a'</code> || <code>a</code> || No single or double quotes |
|- | |- | ||
| − | | Termination | + | | Termination symbol || <code>'a';</code> || <code>a</code> || No termination symbol |
|- | |- | ||
| Concatenation || <code>'a', 'b', 'c'</code> || <code>abc</code> || No spaces, no concatenation operator | | Concatenation || <code>'a', 'b', 'c'</code> || <code>abc</code> || No spaces, no concatenation operator | ||
| Line 35: | Line 38: | ||
|- | |- | ||
| Optional repetition (with separator) || <code>'x', { ',', 'x' }</code> || <code>x[,...]</code> || equal to <code>x[(,x)[...]]</code> | | Optional repetition (with separator) || <code>'x', { ',', 'x' }</code> || <code>x[,...]</code> || equal to <code>x[(,x)[...]]</code> | ||
| + | |- | ||
| + | | Optional repetition (with separator) || <code>'x', { '--', 'x' }</code> || <code>x[--...]</code> || equal to <code>x[(--x)[...]]</code> | ||
| + | |- | ||
| + | | Optional repetition of optional element || <code>{ 'x' }</code> || <code>[x]...</code> || equal to <code>[x[...]]</code> | ||
|} | |} | ||
Latest revision as of 23:40, 7 June 2019
The Prokee Syntax Notation is a notation for syntax rules used by some prokee modules.
Characteristics:
- 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, like ';' (or. '.'). The syntax rules are usually specified individually as separate string literals, which means that no termination symbol is necessary.
- For optional repetitions, "{ }" (as in EBNF) is omitted. Instead, three dots "..." are used to indicate optional continuation. Since repetition is always optional, the three points are 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.
The following table shows a comparison between EBNF and Prokee Syntax Notation.
| 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)[...]]
|
| Optional repetition (with separator) | 'x', { '--', 'x' } |
x[--...] |
equal to x[(--x)[...]]
|
| Optional repetition of optional element | { 'x' } |
[x]... |
equal to [x[...]]
|