Elmo HARSFEN0602, HARmonica software manual Expressions Simple Expressions, Syntax

Models: HARmonica HARSFEN0602

1 220
Download 220 pages 51.63 Kb
Page 33
Image 33

HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARYDRAFT

5.3.4Operator details

The description and syntax is the same as in the Interpreter Language. See Operator details of the Interpreter Language

5.3.5Mathematical functions

The description and syntax is the same as in the Interpreter Language. See Mathematical functions of the Interpreter Language

5.3.6Expressions

5.3.6.1Simple Expressions

The description and syntax is the same as in the Interpreter Language. See Simple Expressions of the Interpreter Language

5.3.6.2Assignment Expressions

The description and syntax is the same as in the Interpreter Language. See Assignment Expressions of the Interpreter Language

User programming language allows multiple assignment to multiple output of the function. Syntax and descrition see at the section

5.3.6.3User variables

User variables are defined within program, using the int or the float declarations.

The keywords for variable types are ‘int’ and ‘float’.

Syntax:

int int_var1, int_var2[12], …, int_varN; float flt_var1[13], flt_var2, flt_varN; int a;

float b;

Variable must be declared before its use (in the expression or assignment).

The definition line of variables consists of type name (int or float) and variable names.

Variables at the definition line must be separated with comma or every variable may be declared at the separate line. Variables may be scalar, or vector. If a variable is a vector, it must be declared its dimension in square brackets after its name.

Only global variable may be one-dimensional array. Neither local variable nor input/output argument of a function can be a vector.

Dimension of the vector must be positive constant number. If dimension is defined as floating-point number, it will be truncated to integer. The dimension that is less than one is illegal.

For example, int arr[12.5] ;

The floating-point number that defines dimension will be truncated to 12. int arr[-2] ;

This variable definition is illegal, because dimension is negative.

Local variables must be defined at the beginning of function bodies. Any local or global variable definition after some executable code of the function is illegal.

For example,

function foo (int a) ** Function definition int b ; ** Local variable definition

b = a ; ** Executable code

float c ; ** Local variable definition

Definition of the variable ‘c’ is illegal, because it is after some executable code.

31

Page 33
Image 33
Elmo HARSFEN0602, HARmonica software manual Expressions Simple Expressions, Syntax