Phrases

Phrases is a pure syntactic way of building a domain-specific expressions. Syntactic purity means that phrases does nothing to the language semantics. Any phrase is just an object construction expression and thus can be written in a canonical form. The only reason of using phrases is better readability.

The phrase syntax is:

<prefix> <part> ...

where

The syntax of concrete phrase is defined by clauses declared in the object the <prefix> resolved to.

Single-Quoted String

A single-quoted string has the same syntax as string, but is enclosed in a single quotes (‘’‘’) instead of a double quotes ("). It can be either a string literal or a text block. Multiple single-quoted strings are also concatenated automatically.

A single-quoted string may not appear outside the phrase.

Interval

An interval is a special syntactical construct suitable for representing of all kinds of intervals: opened and closed, bounded and unbounded. The interval syntax is:

{'[' | '('} [<left bound>] '...' [<right bound>] {']' | ')'}

where:

  • square bracket designates a closed bound,
  • parenthesis designates an open bound,
  • a horizontal ellipsis sign (, U+2026) can be used instead of three dots,
  • <left bound> and <right bound> are bounds, and can be:
    • an arbitrary bound expression,
    • -, (U+221E), or nothing to designate the corresponding bound is missing.

When left and/or right bound is missing the interval should be left- and/or right- opened respectively, i.e. a parenthesis should be used at corresponding side.

Here is some examples:

[a...b] ~~ Closed interval
(a...b) ~~ Open interval
[a...b) ~~ Right-open interval
(a...)  ~~ Left bounded open interval
(a...-) ~~ The same as above
(...b]  ~~ Right-bounded interval.
(∞...b] ~~ The same as above.
(...)   ~~ Fully unbounded interval.
(∞...∞) ~~ The same as above.

Intervals may not appear outside phrases.

Intervals are used, for example, to extract substrings:

"abcde" [1...4) ~~ "bcd"
"abcde" [1...)  ~~ "bcde"
"abcde" (...4]  ~~ "abcd"
"abcde" (...)   ~~ "abcde"

Initializer

An initializer phrase part looks similarly to the phrase argument, i.e. it is a value specified in square brackets. The difference is a = sign prefixing the value itself:

Phrase [= value]

Initializers intended to be used to provide the initial values for objects, in contrast to more general purpose arguments.

An initializer has a special syntax suitable for field initialization:

Field := type = value

, which is a more convenient form of the following declaration:

Field := type [= value]