Structured Text (ST)

ST is a structured literal programming language. A ST program is a list of statements. Each statement describes an action and must end with a semi-colon (";").

The presentation of the text has no meaning for a ST program. You can insert blank characters and line breaks where you want in the program text.

Comments

Comment texts can be entered anywhere in a ST program. Comment texts have no meaning for the execution of the program. A comment text must begin with "(*" and end with "*)". Comments can be entered on several lines (i.e. a comment text may include line breaks). Comment texts cannot be nested.

Expressions

Each statement describes an action and may include evaluation of complex expressions. An expression is evaluated:

- from the left to the right
- according to the default priority order of operators
- the default priority can be changed using parenthesis

Arguments of an expression can be:
- declared variables
- constant expressions
- function calls

Statements

Below are available basic statements that can be entered in a ST program:

- assignment
- function block calling

Below are the available conditional statements in ST language:

- IF / THEN / ELSE (simple binary switch)
- CASE (enumerated switch)

Below are the available statements for describing loops in ST language:

- WHILE (with test on loop entry)
- REPEAT (with test on loop exit)
- FOR (enumeration)