Seed7 
 FAQ 
 Manual 
 Screenshots 
 Examples 
 Algorithms 
 Download 
 Links 

 Manual 
 Introduction 
 Tutorial 
 Syntax 
 Statements 
 Types 
 Parameters 
 Objects 
 File System 
 Declarations 
 Tokens 
 Expressions 
 OS access 
 Actions 
 Errors 

11. EXPRESSIONS

There are two types of expressions. On one side there so called simple expressions which are constructed using fixed predefined syntax rules. On the other side there are expressions which are constructed according to syntax rules defined with syntax declarations. Here we describe only simple expressions. How syntax declarations work is described in the Chapters 3 and 8.2. There are only few fixed predefined syntax rules:

11.1 Parentheses

Parentheses can be used to override any precedence rules of predefined and user defined syntax constructs. For example

    2 * (3 + 4)

specifies that the + operator gets his parameters first.

Syntax:

    parentheses_expression ::=
      '(' expression ')' .

11.2 Call expressions

Call expressions can also be used to form a list. For example

    writeln("hello world")

forms a list expression with the elements

    "hello world"
    writeln

The meta object of this list is specified with the system declaration "system expr" which is defined in the include file "syntax.s7i" included from "seed7_05.s7i" as

    $ system "expr" is expr;

A call expression with two parameters as

    pos("Scotty! Beam me up.", "am")

forms a list expression with the elements

    "Scotty! Beam me up."
    "am"
    pos

Syntax:

    call_expression ::=
      primary_expression [ '(' comma_expression ')' ] .

    primary_expression ::=
      parentheses_expression | atom .

11.3 Dot expressions

Dot expressions start with a dot and have dots as separator between the elements of the list. For example

    .not.TRUE

and

    .OKAY.and.GO_ON

form list expressions with the elements

    not
    TRUE

and

    OKAY
    and
    GO_ON

The meta object of this list is specified with the system declaration "system expr" which is defined in the include file "syntax.s7i" included from "seed7_05.s7i" as

    $ system "expr" is expr;

Dot expressions override the priority of the elements. Dot expressions are used in 'syntax' declarations.

Syntax:

    dot_expression ::=
      [ '.' ] call_expression { '.' call_expression } .