⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pl0err.c

📁 经过修改的PL0编译程序源码
💻 C
字号:
/********************************************************************
    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);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -