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. 理解SQL Server中的权限体系(上)----主体

    原文:http://www.cnblogs.com/CareySon/archive/2012/04/10/mssql-security-principal.html 简介 权限两个字,一个权力,一个 ...

  2. trac项目管理平台

    本文来自百科,由于是非Python开发者,所以仅为了拓宽知识面 1软件介绍 Trac是一个为软件开发项目需要而集成了Wiki和问题跟踪管理系统的应用平台,是一个开源软件应用.Trac以简单的方式建立了 ...

  3. Win2008R2配置WebDeploy

    一.配置服务器 1.安装管理服务 2.点击管理服务进行配置 3.安装WebDeploy 3.1通过离线安装包方式安装: https://www.iis.net/downloads/microsoft/ ...

  4. es安装

    1,安装java(至少1.8) yum install -y java java -version 在/etc/profile追加: JAVA_HOME=/usr/java/jdk1..0_45 PA ...

  5. char,string和CString转换

    &1 string->char string str0 = "sophia is a good girl."; const char *str1 = str0.c_s ...

  6. Linq To Entities 及其相关

    说到Linq,很多人都非常熟悉,我们可以很方便的用它来操纵对象的集合.今天要说的是Linq To Entities及其相关的操作.下面一步一步的来进行.这里我着重强调的是语法上面的一些注意点.所以怎么 ...

  7. Linux常用指令---find | locate(查找)

    1.locate locate指令和find找寻档案的功能类似,但locate是透过update程序将硬盘中的所有档案和目录资料先建立一个索引数据库,在 执行loacte时直接找该索引,查询速度会较快 ...

  8. [MetaHook] R_SparkEffect

    By hzqst void R_SparkEffect(float *pos, int count, int velocityMin, int velocityMax) { efx.R_SparkSt ...

  9. initializer for conditional binding must have optional type not AVAudioPlayer

    if let buttonBeep = self.setupAudioPlayerWithFile("ButtonTap", type: "wav") {    ...

  10. 浩瀚先森(guohao1206.com)

    博客搬家啦,新博客地址:浩瀚先森 http://www.guohao1206.com