/********************************************************************
    Program :  Recursive Descent Compiler for PL/0
    Modul   :  PL0ERR  - Error routine and messages
    File    :  pl0err.c
    Compiler:  Borland C 3.1 - 4.5, GNU C 2.7.1
    Author  :  H. Weber
    Revision:  Aug. 1998
********************************************************************/

#include <stdio.h>

extern FILE *errlist;

char *errtxt[] = {
       "",
 /*1*/ "Use '=' instead of ':=' !",
       "A number must follow after '=' !",
       "The identifier must be followed by '=' !",
       "After 'const', 'var' and 'procedure' follows an identifier !",
       "Semicolon or comma missing !",
       "",
       "Statement or declaration expected !",
       "Symbol following the statements of the block not correct !",
       "Period expected !",
       "Incorrect use of a symbol within a statement !",
/*11*/ "Undeclared identifier !",
       "Assignments to a constant or procedure name not allowed !",
       "Assignment operator is ':=' !",
       "After 'call' a procedure identifier is expected !",
       "Constant or variable identifier after call not allowed !",
       "'then' expected !",
       "'end' or ';' expected !",
       "'do' expected !",
       "Illegal symbol following a statement !",
       "Comparison operator expected !",
/*21*/ "procedure identifier within an expression not allowed !",
       "Missing ')' !",
       "This symbol cannot follow a factor !",
       "An Expression may not start with this symbol !",
       "",
       "",
       "",
       "",
       "",
       "number too large !",
/*31*/ "program too long !",
       "procedure nesting too deep !",
       "identifier expected !",
       "semicolon missing !",
       "'until' expected !",
       "'of' expected !",
       "Case table overflow !",
       "':' expected !",
       "Number expected !",
       "Multiple definition of case label !",
/*41*/ "'end' expected !",
       "String expected !",
       "Missing '(' !",
       "'to' or 'downto' expected !",
       "Multiple declaration in block !",
       "Illegal symbol following a '[' !",
       "']' expected !",
       "'[' expected !",
       "Symbol table full !",
/*50*/ "Array dimension <= 0 !"
   };

void error(int n)
{
   fprintf(stderr, "Error %d: %s\n", n, errtxt[n]);
   fprintf(errlist, "Error %d: %s\n", n, errtxt[n]);
   exit(1);
}
