Seed7 
 FAQ 
 Manual 
 Screenshots 
 Examples 
 Algorithms 
 Download 
 Links 

 Manual 
 Introduction 
 Tutorial 
 Syntax 
 Statements 
 Types 
 Parameters 
 Objects 
 File System 
 Declarations 
 Tokens 
 Expressions 
 OS access 
 Actions 
 Errors 

14. ERRORS

14.1 Compile time errors

The compile time errors are not fatal (the program can execute) except for the error 1 (Out of heap space) which terminates the compilation process and no execution occurs.

   1: Fatal Error: Out of heap space
   2: File "%s" not found
   3: Include file "%s" not found
   4: "END OF FILE" encountered
   5: Illegal character in text "%s"
   6: Unclosed comment
   7: Illegal pragma "%s"
   8: Illegal action "%s"
   9: Illegal system declaration "%s"
  10: Integer "%s" too big
  11: Negative exponent in integer literal
  12: Digit expected found "%s"
  13: Integer "%dE%s" too big
  14: Integer base "%ld" not between 2 and 36
  15: Extended digit expected found "%s"
  16: Illegal digit "%c" in based integer "%d#%s"
  17: Based integer "%d#%s" too big
  18: "'" expected found "%s"
  19: Character literal exceeds source line
  20: Use \" instead of "" to represent " in a string
  21: Use / instead of \\ as path delimiter
  22: Illegal string escape "\%s"
  23: Numerical escape sequences should end with "\" not "%s");
  24: String continuations should end with "\" not "%s");
  25: String literal exceeds source line
  26: Name expected found "%s"
  27: Integer literal expected found "%s"
  28: String literal expected found "%s"
  29: Identifier expected found "%s"
  30: Expression expected found "%s"
  31: Expression expected after "begin"
  32: Declaration expected found "%s"
  33: Initialisation of "%s" failed
  34: "%s" declared twice
  35: "%s" not declared
  36: Associativity expected found "%s"
  37: Statement priority "%s" too big
  38: Syntax with two parameters before operator is illegal
  39: Empty syntax declaration
  40: "%s" redeclared with infix priority %d not %d
  41: "%s" redeclared with prefix priority %d not %d
  42: Priority %d required for parameter after "%s" not %d
  43: Priority <= %d expected found "%s" with priority %d
  44: Priority <= %d expected found "%s" with priority %d
  45: "%s" must have priority %d not %d for dot expression
  46: "%s" expected found "%s"
  47: "%s" expected found "%s"
  48: Undefined type for literal "%s"
  49: "newtype", "subtype", "func", "enumlit" or "action" expected found "%s"
  50: "func" or "type" expected found "%s"
  51: Match for %s failed
  52: Variable expected in %s found %s
  53: Type expected found %s
  54: Procedure expected found %s expression
  55: Parameter specifier expected found "%s"
  56: Evaluate type expression %s failed
      Undefined error

14.2 Exceptions

There are various exceptions which can be raised during program execution:

MEMORY_ERROR:
May be raised by various operations of the following types: array, struct, hash, file, func, proc, reference, string. Additionally the interpreter kernel may raise this exception also.
NUMERIC_ERROR:
May be raised from the following 'integer' operations: !, **, div, rem, mdiv, mod, ld. May be raised from the following 'bigInteger' operations: **, div, rem, mdiv, mod.
RANGE_ERROR:
May be raised from the following 'integer' operation: parse, rand. May be raised from the following 'bigInteger' operation: parse, rand. May be raised from the following 'float' operation: parse, rand. May be raised from the following 'char' operation: str. May be raised from the following 'string' operation: @:=, mult, pos. May be raised from the following 'bitset' operation: min, max, rand. May be raised from the following 'array' operation: [ ]. May be raised from the following 'hash' operation: [ ]. May be raised from the following 'file' operation: open, gets, write, seek.
IO_ERROR:
May be raised with the following statement: cp
ILLEGAL_ACTION:
May be raised by the interpreter kernel when a primitive action does not point to any legal action. This check is only done when the hi interpreter is compiled with '#define WITH_ACTION_CHECK'. The ILLEGAL_ACTION exception is also raised when the primitive action ACT_ILLEGAL is executed.

14.3 Handlers

To catch an EXCEPTION the following handler construct can be used:

    block
      number := 1 div 0;
    exception
      catch NUMERIC_ERROR:
        number := 1;
    end block;

14.4 Stack trace

When an EXCEPTION is not catched at any level the program is terminated and the hi interpreter generates a stack trace. For example:

    *** Uncaught EXCEPTION NUMERIC_ERROR raised with
    {integer <80b2e64>:  0 div integer <80b2e64>:  0 }

    {(in integer <80b2e64> param) div (in integer <80b2e64> param) } at lander.sd7(1028)
    drawLogo {} at lander.sd7(1080)
    advanced_lander {} at lander.sd7(873)
    setup {} at lander.sd7(1441)
    main {} no POSINFO

14.5 Other errors and warnings

No more memory. Program terminated.
This error message is displayed after the compile time error 1 (Out of heap space) . The file name and line number of the analyzer source code where this happens is displayed together with internal heap information. If this happens the -m option can be used to make more memory available. Perhaps this slows the compilation phase down.
System declaration for main missing
Each program must contain a system declaration that describes which procedure to start as first one.
EXCEPTION %s raised with
If your trace level specifies exception tracing exceptions and handlers are displayed with this messages and the user must type the ENTER-key to accept.
ACTION $%s REQUIRES %s NOT %s
This error can happen when an action tries to do something with the wrong primitive value. For example adding an integer to a string with INT_ADD. Since the analyze phase checks for the right types this error can only happen when the basic libraries are defined wrong.
ACTION $%s REQUIRES VARIABLE %s NOT %s
This error can happen with actions which assign a value to a constant. Since the analyze phase checks for variable objects this error can only happen when the basic libraries are defined wrong. Principally this error is possible with the following operations: :=, incr, decr, wrd_rd, lin_rd