1:  package compiler;
   2:   
   3:  import java.io.BufferedWriter;
   4:   
   5:  public class Err {
   6:   
   7:      public  int errCount = 0;
   8:      public static final String[] errInfo = new String[]{
   9:          "",
  10:          "1.应是=而不是:=",
  11:          "2.=后应为数",
  12:          "3.标识符后应为=",
  13:          "4.const,var,procedure 后应为标识符",
  14:          "5.漏掉逗号或分号",
  15:          "6.过程说明后的符号不正确",
  16:          "7.应为语句",
  17:          "8.程序体内语句后的符号不正确",
  18:          "9.应为句号",
  19:          "10.语句之间漏分号",
  20:          "11.标识符未说明",
  21:          "12.不可向常量或过程名赋值",
  22:          "13.应为赋值运算符:=",
  23:          "14.call后应为标识符",
  24:          "15.不可调用常量或变量",
  25:          "16.应为then",
  26:          "17.应为分号或end",
  27:          "18.应为do",
  28:          "19.语句后的符号不正确",
  29:          "20.应为关系运算符",
  30:          "21.表达式内不可有过程标识符",
  31:          "22.漏右括号",
  32:          "23.因子后不可为此符号",
  33:          "24.表达式不能以此符号开始",
  34:          "25.这个数太大",
  35:          "26.Not Defined Yet",
  36:          "27.Not Defined Yet",
  37:          "28.Not Defined Yet",
  38:          "29.Not Defined Yet",
  39:          "30.Not Defined Yet",    
  40:          "31.数越界",
  41:          "32.嵌套层数过大",
  42:          "33.格式错误,应为右括号",
  43:          "34.格式错误,应为左括号",
  44:          "35.read()中的变量未声明"
  45:      };
  46:   
  47:      /**
  48:       * 打印错误信息
  49:       * @param errcode 
  50:       */
  51:      public  void report(int errcode,int line) {
  52:          try {
  53:              System.out.println("*** line( "+line+"):" + errInfo[errcode] + "  ***");
  54:              PL0.errWriter.write("*** line ( "+line+"):"+ errInfo[errcode] + "  ***\n");
  55:              errCount++;
  56:          }catch(Exception e){
  57:              e.printStackTrace();
  58:              System.out.println("***print error infomation meet with error***");
  59:          }
  60:   
  61:      }
  62:  }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

PL/0编译器(java version) - Err.java的更多相关文章

  1. PL/0编译器(java version) - MainFrame.java

    1: /* 2: * To change this license header, choose License Headers in Project Properties. 3: * To chan ...

  2. PL/0编译器实践---后记

    花了几天时间,把清华版的<编译原理>一书中的PL/0编译器实践了一遍.颇有收获,记录如下: 理解代码的技巧,如何理解一份代码,比如这个程序,其逻辑相对于一般程序就比较复杂了,如何翻译,虚拟 ...

  3. PL/0编译器(java version)–Praser.java

    1: package compiler; 2:   3: import java.io.IOException; 4: import java.util.BitSet; 5:   6: /** 7: ...

  4. PL/0编译器(java version) – SymbolTable.java

    1: package compiler; 2: //竟然没有对符号表检查大小,会溢出的. 3:   4: import java.io.IOException; 5:   6: public clas ...

  5. PL/0编译器(java version) – Scanner.java

    1: package compiler; 2:   3: import java.io.BufferedReader; 4: import java.io.FileNotFoundException; ...

  6. PL/0编译器(java version)–PL0.java

    1: package compiler; 2:   3: import java.io.BufferedWriter; 4: import java.io.FileWriter; 5:   6: /* ...

  7. PL/0编译器(java version) - Interpreter.java

    1: package compiler; 2:   3: import java.io.BufferedReader; 4: import java.io.BufferedWriter; 5: imp ...

  8. PL/0编译器(java version) – Symbol.java

    1: package compiler; 2:   3: /** 4: * 采用全局变量sym来存储符号码,并用全局变量id和num来传递语义值 5: * 6: * @author jiangnan ...

  9. PL/0编译器(java version)–Pcode.java

    1: package compiler; 2:   3: /** 4: * //虚拟机指令 5: * 6: * @author jiangnan 7: * 8: */ 9: public class ...

随机推荐

  1. Pureftp-安全的ftp服务器部署

    一.简介: Pure-FTPd 是一款免费(BSD)的,安全的,高质量和符合标准的FTP服务器. 侧重于运行效率和易用性. 它提供了简单的答案,他满足了大众化的需求,包括普通用户以及主机供应商们 Pu ...

  2. 为什么我的SQL server 在附加数据库后,数据库总是变成了只读?

    我从同学那拷贝来一个数据库,在他那都可以用,可是当我附加到自己SQL Server上时,数据库显示为只读,我查看过数据库源文件所在的文件夹都正常!请高手指教!谢谢 ================== ...

  3. js window.open()实现打印,如何在关闭打印窗口时刷新父窗口

    var childWin = window.open("your URL"); //获取子窗口句柄childWin.onunload = function(){ //onunloa ...

  4. SVPullToRefresh​ 下拉刷新,上拉加载

    https://github.com/Sephiroth87/ODRefreshControl 类似刷新控件,类似qq动画的那种刷新. 一.下载第三方库 https://github.com/samv ...

  5. Core Data 概述

    Core Data是一个模型层的技术.Core Data帮助你建立代表程序状态的模型层.Core Data也是一种持久化技术,它能将模型对象的状态持久化到磁盘,但它最重要的特点是:Core Data不 ...

  6. 如何自定义FloatingActionButton的大小

    Google最近为了让开发者更好的更规范的应用Material Design设计思想,特意放出了android support design library,里面含有更多Material Design ...

  7. redis async client 与自有框架集成

    hiredis的异步接口已经支持ae libuv libev 和 libevent集成,具体头文件可以参见redis/deps/hiredis/adapters,样例参见redis/deps/hire ...

  8. python3 入门 (二) 列表的使用

    列表用于组织其它数值,即写在方括号之间.用逗号分隔开的数值列表.列表内的项目不必全是相同的类型. 列表的定义 student = ['Tom', 'Jack', 'Avril'] 添加元素 将另一个列 ...

  9. 关于1Byte 1K 1M 1G(换算)

    1个字节等于8位二进制 .... 1byte=8bit 1K = 1024 byte =1024byte*8b 说白一点就是 1M等于1024个K组成,而1K又等于1024B,所以1M等于1024K乘 ...

  10. Bootstrap3.0学习第二十三轮(JavaScript插件——警告框)

    详情请查看http://aehyok.com/Blog/Detail/29.html 个人网站地址:aehyok.com QQ 技术群号:206058845,验证码为:aehyok 本文文章链接:ht ...