![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
编译原理实验
文章平均质量分 80
莯风
欢迎访问:https://miaohn.github.io
展开
-
xjtu 编译原理实验 03
词法分析 本次实验准备借助 lex 写一个 C 语言子集的词法分析程序 lex 文件的写法 一个简单例子 先从例子入手吧,下面的例子用来统计文本行数: %{ #include <stdio.h> int lines = 1; %} %% \n { lines++; } . ; %% int main(int argc, char** argv) { if (argc == 2) { if ((yyin = fopen(argv[1], "r")) == NULL)原创 2022-05-29 19:36:36 · 436 阅读 · 0 评论 -
xjtu 编译原理实验 02
Cool 语言堆栈机 1. 操作说明 命令 含义 int 将整数数添加到栈中 + 栈中压入 + s 栈中压入 s e 计算栈顶表达式的值(详见下文) d 打印栈中内容 x 退出 e 命令的作用: 如果 + 在栈顶,那么 + 出栈,栈顶两整数弹出并相加,将结果压入栈 如果 s 在栈顶,那么 s 出栈,下面两个选项在栈内交换 2. 栈的实现 2.1 内部成员变量 cool 语言是一种面向对象的语言,所有函数和值都是以对象的形式存在,栈的实现也要以对象的形式进行。由于不原创 2022-05-29 19:31:54 · 280 阅读 · 0 评论 -
xjtu 编译原理实验 01
初始 Cool 语言 Cool, an acronym for Classroom Object Oriented Language, is a computer programming language designed by Alexander Aiken for use in an undergraduate compiler course project. While small enough for a one term project, Cool still has many of the f原创 2022-05-29 19:27:49 · 424 阅读 · 0 评论