Sentences

A sentence combines statements with respect to their logical meaning. Sentences make it possible to write complex logic in a simpler manner, which may be called truly intuitive, because it is close to the natural text.

Sentences form an object definition within a constructor expression, or within blocks of the phrase.

The sentence is a sequence of zero or more statements delimited by commas (,) or semicolons (;) and optionally terminated with period (.), question mark (?), exclamation mark (!), or their combinations (?.. or !..).

The declarative code may only contain declarative sentences terminating with periods (.), and interrogative sentences terminating with question marks (?).

The imperative code may contain any kinds of sentences.

Sentence Termination

The termination mark can be omitted for the last sentence of the block. It can also be omitted at the end of the line.

If the termination mark is omitted, and no separator (colon or semicolon) present after the last statement, the sentence is automatically terminated with period (.).

An underscore should be used to continue a statement to the next line.

Declarative Sentence

A declarative sentence is the default sentence kind. It is a regular way of building object definitions.

The following sentence defines a value for an object:

= 2

While the following defines only a logical value:

a > 0

Evaluation

Statements within declarative sentence are evaluated in their order. The sentence evaluation result may be one of the following:

  • If the sentence is empty, it is ignored and evaluation continues to the next sentence.
  • If a return or yield statement successfully executed, a value is returned and the sentence evaluation finishes.
  • If statements evaluated to false (i.e. the last alternative failed), a false value is returned and evaluation finishes.
  • Otherwise, (i.e. when some alternative succeed and did not contain a return or yield statement) the evaluation continues to the next sentence.

The following sentence states that the value should be positive:

Value > 0

So, an object declaration can look like this:

Object := void (
  Value := 1 ~~ This is a definition of `value`.
  Value > 0  ~~ `Value` should be positive in order the evaluation to continue
             ~~ and result to inherited `void` value.
             ~~ Otherwise, an object value will be false.
)

Interrogative Sentence

An interrogative sentence is terminated with a question mark (?).

The sentence following an interrogative one will be evaluated only when interrogative sentence succeed. Otherwise, the sentence following the next non-interrogative sentence will be evaluated.

Some examples:

Arg > 0? = 1  ~~ If `arg` is positive, return `1`.
Arg < 0? = -1 ~~ Otherwise, if `arg` is negative, return `-1`.
= 0           ~~ Otherwise, return `0`.

An interrogative sentence may follow another interrogative sentence. In this case statements of theses sentences are combined with logical AND. So, the following definitions are equal:

Age >= 10? Age <= 19? = "teen" 
Age >= 10, age <= 10? = "teen"

An interrogative sentence alone (e.g. as a last sentence of declarative block) is treated as preceding an empty sentence.

An interrogative sentence may not contain any member declarations, return or yield statements, or imperative blocks.