interpreter error messages

1. Interpreter
2. Introduction
3. Error messages
   1.   Lexical error: Illegal symbol in code
   2.   Parse error
   3.a. Variable not defined
     b. Procedure not defined
     c. Variable already defined
     d. Procedure already defined
   4.a. Statement "Read" not implemented, it will be ignored in execution
     b. Variable being modified appears on RHS
     c. Variable being modified appears on LHS
     d. No space allocated
   5.a. Maximum space allocated (4000 memory cells)
     b. Array out of bound
     c. Division by zero
   6.a. test (after if) is false and assertion (after fi) is true in fwd computation
     b. test (after if) is true and assertion (after fi) is false in fwd computation
     c. test (after fi) is false and assertion (after if) is true in bwd computation
     d. test (after fi) is true and assertion (after if) is false in bwd computation
     e. The assertion (after from) should be true in fwd computation
     f. The assertion (after from) should be false in fwd computation
     g. The assertion (after until) should be true in bwd computation
     h. The assertion (after until) should be false in bwd computation
     i. Failure to extend the heap or stack
     j. Time's up (maximum execution time is 2 minutes)
     k. Trace to long (10 MB)
   7.   User defined error
4. Example programs

1. Lexical error: Illegal symbol in code

Example: 000 procedure test 001 !@%&/

2. Parse error

Example: 000 procedure procedure

3.a. Variable not defined

Example: 001 procedure test 002 i ^= 42

3.b. Procedure not defined

Example: 000 procedure test 001 call unknown

3.c. Variable already defined

Example: 000 x x 001 002 procedure test 003 x ^= 42

3.d. Procedure already defined

Example: 000 x 001 002 procedure test 003 x ^= 42 004 005 procedure test 006 x ^= 42

4.a. Statement "Read" not implemented, it will be ignored in execution

Example: 000 x 001 002 procedure test 003 read x

4.b. Variable being modified appears on RHS

Example: 000 x 001 002 procedure test 003 x ^= x

4.c. Variable being modified appears on LHS

Example: 000 x[1] 001 002 procedure test 003 x[x[0]] ^= 1

4.d. No space allocated

Example: 000 x[0]

5.a. Maximum space allocated (4000 memory cells)

Example: 000 x[4001]

5.b. Array out of bound

Example: 000 x[4] 001 002 procedure test 003 x[10] ^= 42

5.c. Division by zero

Example: 000 x 001 002 procedure main 003 x ^= 42 % 0

6.a. test (after if) is false and assertion (after fi) is true in fwd computation

Example: 000 procedure test 001 if 0 fi 1

6.b. test (after if) is true and assertion (after fi) is false in fwd computation

Example: 000 procedure test 001 if 1 fi 0

6.c. test (after fi) is false and assertion (after if) is true in bwd computation

Example: 000 procedure test 001 if 1 fi 0 002 003 procedure main 004 uncall test

6.d. test (after fi) is true and assertion (after if) is false in bwd computation

Example: 000 procedure test 001 if 0 fi 1 002 003 procedure main 004 uncall test

6.e. The assertion (after from) should be true in fwd computation

Example: 000 procedure test 001 from 0 until 0

6.f. The assertion (after from) should be false in fwd computation

Example: 000 procedure test 001 from 1 until 0

6.g. The assertion (after until) should be true in bwd computation

Example: 000 procedure test 001 from 0 until 0 002 003 procedure main 004 uncall test

6.h. The assertion (after until) should be false in bwd computation

Example: 000 procedure test 001 from 0 until 1 002 003 procedure main 004 uncall test

6.i. Failure to extend the heap or stack

Example: 000 procedure test 001 call test

6.j. Time's up (maximum execution time is 2 minutes)

Example: 000 x 001 002 procedure test 003 from x = 0 004 do x += 1 005 until x = 14000000

6.k. Trace to long (10 MB)

Note: Only applicable in trace mode Example: 001 x 002 003 procedure test 004 from x = 0 005 do x += 1 006 until x = 400000

7. User defined error

Example: 000 procedure test 001 error "User defined error"