上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: 1: package compiler; 2: 3: /** 4: * 采用全局变量sym来存储符号码,并用全局变量id和num来传递语义值 5: * 6: * @author jiangnan 7: * 8: */ 9: public class Symbol { 10: 11: //各类符号码 12: ... 阅读全文
posted @ 2014-02-22 16:23 姜楠 阅读(741) 评论(0) 推荐(0) 编辑
摘要: 1: package compiler; 2: 3: import java.io.BufferedReader; 4: import java.io.FileNotFoundException; 5: import java.io.FileReader; 6: import java.util.Arrays; 7: 8: public cla... 阅读全文
posted @ 2014-02-22 16:21 姜楠 阅读(742) 评论(0) 推荐(0) 编辑
摘要: 1: package compiler; 2: 3: import java.io.IOException; 4: import java.util.BitSet; 5: 6: /** 7: * 语法分析器。 这是PL/0分析器中最重要的部分, 在语法分析的过程中嵌入了语法错误检查和目标代码生成。 8: * 9: * @author... 阅读全文
posted @ 2014-02-22 16:20 姜楠 阅读(1834) 评论(0) 推荐(0) 编辑
摘要: 1: package compiler; 2: 3: import java.io.BufferedWriter; 4: import java.io.FileWriter; 5: 6: /** 7: * 组织输入输出接口 8: * 9: * @author jiangnan 10: */ 11: public class... 阅读全文
posted @ 2014-02-22 16:15 姜楠 阅读(1564) 评论(0) 推荐(0) 编辑
摘要: 1: package compiler; 2: 3: /** 4: * //虚拟机指令 5: * 6: * @author jiangnan 7: * 8: */ 9: public class Pcode { 10: 11: public Pcode(int f, int l, int a) { 12: ... 阅读全文
posted @ 2014-02-22 16:13 姜楠 阅读(780) 评论(0) 推荐(0) 编辑
摘要: 1: package compiler; 2: 3: import java.io.BufferedReader; 4: import java.io.BufferedWriter; 5: import java.io.IOException; 6: import java.util.Arrays; 7: import java.util.logging.Level; 8: import java.util.logging.Logger; 9: 10: /** 11: * 类P-code代码解释器(含代码生成函数) 12:... 阅读全文
posted @ 2014-02-22 16:12 姜楠 阅读(1043) 评论(0) 推荐(0) 编辑
摘要: 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 Str... 阅读全文
posted @ 2014-02-22 16:10 姜楠 阅读(547) 评论(0) 推荐(0) 编辑
摘要: 1: /* 2: * To change this license header, choose License Headers in Project Properties. 3: * To change this template file, choose Tools | Templates 4: * and open the template in the ed... 阅读全文
posted @ 2014-02-22 16:08 姜楠 阅读(1102) 评论(0) 推荐(1) 编辑
摘要: 包 lexer 是词法分析器的代码的扩展。类 Tag 定义了各个词法单元对应的常量。 1: package lexer; 2: public class Tag { 3: public final static int 4: AND = 256 , BASIC = 257 , BREAK = 258 , DO = 259 , ELSE = 260... 阅读全文
posted @ 2014-01-17 22:26 姜楠 阅读(815) 评论(0) 推荐(1) 编辑
摘要: 程序的执行从类Main的方法main开始。方法main创建了一个词法分析器和一个语法分析器,然后调用语法分析器中的方法program。 1: package main; 2: import java.io.*; 3: import lexer.*; 4: import praser.*; 5: public class Main{ 6: public s... 阅读全文
posted @ 2014-01-17 19:57 姜楠 阅读(501) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页