HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARYDRAFT

 

 

 

 

 

 

 

 

 

 

55

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

float c, d;

 

 

 

 

 

 

The definition of float variables ‘c’ and ‘d’ is illegal, because it occurs after

 

 

 

 

 

 

executable code ‘b = a’

 

 

30

Variable is undefined

 

This error appears if iteration variable at ‘for’ statement is not defined before

 

 

 

 

 

 

it.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

function foo (int a) ** Function definition

 

 

 

 

 

 

for k = 1 : 10 ** Start ‘for’ loop

 

 

 

 

 

 

a = k ;

 

 

 

 

 

 

end ** End ‘for’ loop

 

 

 

 

 

 

return ; ** Function end

 

 

 

 

 

 

The iteration variable ‘k’ is not defined before its use.

 

 

31

Bad separator between

 

Bad separator between dimensions (not comma). This error is unused,

 

 

 

 

dimensions

 

because currently it is allowed only one-dimensional arrays and no needs in

 

 

 

 

 

 

separator between dimensions.

 

 

32

Bad variable dimension

 

Legal variable dimension must be a positive number inside square brackets. If

 

 

 

 

 

 

the expression inside square brackets is not evaluated into a number or this

 

 

 

 

 

 

number is less then one (zero or negative), it’s illegal.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

int arr[-12];

 

 

 

 

 

 

Variable dimension is negative.

 

 

33

Bad function format

 

This error appears at the function definition in the following cases:

 

 

 

 

 

 

1. Illegal function name – not distinct or empty, etc

 

 

 

 

 

 

2. Function definition does not match to its prototype

 

 

 

 

 

 

For example,

 

 

 

 

 

 

function foo (int a) ; ** Function prototype

 

 

 

 

 

 

function foo (float a) ** Function definition

 

 

 

 

 

 

Type of input arguments at the function definition and its prototype does not

 

 

 

 

 

 

match.

 

 

34

Illegal minus

 

Minus is illegal in the following cases:

 

 

 

 

 

 

1. Minus before function call with multiple output arguments

 

 

 

 

 

 

2. Minus before round parentheses with multiple expressions inside it.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

[a,b] = -foo(c) ;

 

 

 

 

 

 

-(2+3, c/5);

 

 

 

 

 

 

The first example has illegal minus before function call with multiple

 

 

 

 

 

 

outputs.

 

 

 

 

 

 

The second example has illegal minus before multiple expressions within

 

 

 

 

 

 

round parentheses.

 

 

35

Empty program

 

User program is empty

 

 

36

Program is too long

 

User program exceeds maximal admissible length

 

 

37

Bad function call

 

The following reasons cause this error:

 

 

 

 

 

 

1. Attempt to jump at the ‘goto’ statement to the function with non zero

 

 

 

 

 

 

number of input or output arguments

 

 

 

 

 

 

2. Consider example:

 

 

 

 

 

 

[a,b,c] = foo(x,y) + 5;

 

 

 

 

 

 

This sentence is illegal.

 

 

 

 

 

 

The Compiler checks if there is an expression terminator straight after

 

 

 

 

 

 

function call with multiple outputs. Otherwise it sets this error.

 

 

38

Expression is expected

 

This error appears when expected expression is absent. It may occur at ‘wait’,

 

 

 

 

 

 

‘until, ‘while’, ‘if’, ‘elseif’, ‘switch’ and ‘case’ statements.

 

 

 

 

 

 

For example,

 

 

 

 

 

 

if

 

 

 

 

 

 

a = 0

 

 

 

 

 

 

end

 

 

 

 

 

 

An expected expression after ‘if’ is absent.

 

 

Page 57
Image 57
Elmo HARSFEN0602, HARmonica software manual Preliminarydraft