SIMPOL Documentation

Expressions and Statements

Expressions are the building blocks of a program. Variables and operators are combined together to produce a result. An expression can be extremely simple or exceedingly complex. Simple expressions consist of two variables, a variable and a constant, or two constants that are added, subtracted, etc. that produce a value. Below are some examples of expressions:

x + y
3 * x
s + "hello"
(3 - z)/((x + y) * 9)

A statement is made up of one or more expressions and accomplishes something. It is considered to be a complete unit of grammar within a programming language and must be ended with an end-of-statement character. In SIMPOL the end-of-statement character can be the end of the line, the semi-colon (;), or the colon (:). As can be seen from the expressions in the example above, there is no result that occurs, regardless of how complex the expression is, since in no case is the expression being assigned to something or the result of the expression being used in some way.

Statements come in a number of varieties: assignment statements, if statements, while statements, and function calls. The number and variety of statements in a programming language is directly related to the number of keywords to be found in that language. In SBL there is very large number of keywords and a thus a proportionally large number of different statements: MENU-, ADD FORM-, ADD DIALOG-, and SET-statements and numerous others, often with cryptic parameters in varying combinations. The level of complexity in learning a language is directly proportional to this. In SIMPOL there is a very small set of keywords and therefore a similarly small set of statements. Complexity is added by adding objects, but even there, a great deal of attention has been paid to ensuring that the objects are extremely consistent in their design and have methods and properties in common wherever it would make sense to do so. Below are some examples of statements:

z = x + y
f.amount = 3 * x
if s + "hello" == "othello"
while (3 - z)/((x + y) * 9) > 0
foo(z2)

In each of the statements in the example above, the expression is being either assigned, evaluated, or is a call to another function.