Next: , Previous: , Up: aime   [Index]


7 Expressions And Statements

Expressions are semantical units of aime programs. They may evaluate to values and their evaluation may have side effects, like changing variable values, program output, etc.

Expressions have values of constituent atoms modified by unary operators and composed by binary operators. The expression atoms may be variables, literal constants or function calls.

The expression syntax has the atoms connected by binary operators. The expression evaluation order may be changed by grouping atoms with parentheses. Atoms and grouped atoms may be prefixed by unary operators.

    0
    a + b
    (c + d) * 2
    pow(2, e - f) * exp(g)
    6 - min(max(4, h), i)
    o_integer(j)

Statements are functional units of aime programs. They instruct the aime interpreter to do something, hence the statement and instruction terms are used interchangeably.

The syntax of simple statements has expressions followed by semicolons.

    o_text("Hello, World!\n");
    a = b;
    3;
    pow(6, 6);
    o_integer(exp(4));
    c = 7 * abs(d) << 3;
    f_open(input, "/dev/stdin", OPEN_READ, 0);