电子科技大学 编译原理期末女娲补天

这篇博客详细梳理了电子科技大学编译原理课程的期末复习内容,涵盖了语言部分如变量属性、虚拟机概念、数据类型作用、控制结构等,以及编译部分的词法分析、语法分析(如SLR(1)分析法)和语义子程序翻译等关键知识点。博主建议先通读PPT,针对不理解的部分进行百度搜索或观看B站视频以辅助理解。博客中还包含真题和部分例题,但图片链接可能存在问题,建议直接查看语雀链接获取完整资料。
摘要由CSDN通过智能技术生成

算是考完了 真难啊。。 学弟学妹们看到了可以参考下 内有真题一套 稍有些混乱的复习笔记一堆 不建议全部相信 因为本人复习得比较拉胯。。
参考下是ok的 语雀链接食用体验更佳 戳这里

考完来简单总结下
题目与往年差不太多

  • 语法树
  • FIRSTVT表 LASTVT集
  • FIRST集 FOLLOW集 构造预测分析表
  • 中间代码分析
  • SLR(1)分析法
  • 语义子程序的翻译

经验总结:ppt直接看根本看不懂 顺序也比较奇怪 建议先通读一遍ppt 有不懂的先跳过 然后重要知识点多百度一下 可以去bilibili听一些up主讲一下

我晕 图片因为是语雀导出的 所以链接有点问题 懒得改了 咱就是说 建议看语雀上的内容哈 戳这里
编译原理知识点小结.png

语言部分

1-变量及其属性

变量是对一个(或若干个)存储单元的抽象,赋值语句则是修改存储单元内容的抽象。

属性:
  • 作用域:可以访问该变量的程序范围
  • 生存期:一个储存区绑定于一个变量的时间区间
  • 值:变量对应的存储单元的内容
  • 类型:与变量相关联的值的类, 以及对这些值进行的操作的说明。

1-虚拟机的概念

![image.png](https://img-blog.csdnimg.cn/img_convert/4ea42b00770d306ab2d814f608d83c3d.png#clientId=u43ff57c7-d1bf-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=354&id=ufd028177&margin=[object Object]&name=image.png&originHeight=443&originWidth=921&originalType=binary&ratio=1&rotation=0&showTitle=false&size=60450&status=done&style=none&taskId=u97a96f7f-845d-488a-8fde-1b0e9da8cea&title=&width=736.8)

1-程序单元 & 单元实例

![image.png](https://img-blog.csdnimg.cn/img_convert/a29ee9edde321e691997abada95ea9cb.png#clientId=u43ff57c7-d1bf-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=102&id=ua5e9e170&margin=[object Object]&name=image.png&originHeight=127&originWidth=777&originalType=binary&ratio=1&rotation=0&showTitle=false&size=27477&status=done&style=none&taskId=ub53aec50-8eb1-4677-9517-ab5c982c9e7&title=&width=621.6)
![image.png](https://img-blog.csdnimg.cn/img_convert/a3958e7b07bc8dc20d26ed1b3ba756a3.png#clientId=u43ff57c7-d1bf-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=183&id=u8aae8fe3&margin=[object Object]&name=image.png&originHeight=229&originWidth=751&originalType=binary&ratio=1&rotation=0&showTitle=false&size=46256&status=done&style=none&taskId=ub08c3f54-1add-481c-b421-9ca447cb1b9&title=&width=600.8)

  • 活动记录:执行单元所需要的信息,以及该单元的局部变量所绑定的数据对象的存储区

2-数据类型的作用

简答题~

  • 实现了数据抽象
  • 使程序员从机器的具体特征中解脱出来
  • 提高了编程效率

2-数据聚合的六种方式

填空题~
![image.png](https://img-blog.csdnimg.cn/img_convert/7897ffa1407d29a8f86b39154567ec04.png#clientId=u43ff57c7-d1bf-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=334&id=u76a6340b&margin=[object Object]&name=image.png&originHeight=417&originWidth=958&originalType=binary&ratio=1&rotation=0&showTitle=false&size=64229&status=done&style=none&taskId=uc14c57dc-64c5-45e4-a39b-d6bf6ba93ca&title=&width=766.4)

2-类型检查及分类

  • 对数据对象的类型和使用的操作是否匹配的一致性检查称为类型检查
    • 静态检查
    • 动态检查

![image.png](https://img-blog.csdnimg.cn/img_convert/222c54acc3d7cf5b0d7882076fe757e0.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=237&id=ub1ec4e54&margin=[object Object]&name=image.png&originHeight=296&originWidth=945&originalType=binary&ratio=1&rotation=0&showTitle=false&size=89989&status=done&style=none&taskId=u356cb54e-7b02-4164-a2a0-be2d01c67b0&title=&width=756)

2-抽象数据类型的条件

  • 在实现该类型的程序单元中,建立与表示有关的基本操作;
  • 对使用该类型的程序单元来说,该类型的表示是隐蔽的。

![image.png](https://img-blog.csdnimg.cn/img_convert/bd7a7f41b7170652423cd51d7f5d08bd.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=441&id=u364192c8&margin=[object Object]&name=image.png&originHeight=551&originWidth=902&originalType=binary&ratio=1&rotation=0&showTitle=false&size=97074&status=done&style=none&taskId=uc12038a7-3563-4926-b922-bf2acc13e0d&title=&width=721.6)

2-何为类型等价

![image.png](https://img-blog.csdnimg.cn/img_convert/5ae8c0d480687bc024939988ac9cdb9b.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=374&id=u5ccef115&margin=[object Object]&name=image.png&originHeight=467&originWidth=893&originalType=binary&ratio=1&rotation=0&showTitle=false&size=99995&status=done&style=none&taskId=u257d2868-c304-434a-b651-0dfd3e7c0e9&title=&width=714.4)

3-语句级控制结构——顺序、选择、重复

  • 顺序

![image.png](https://img-blog.csdnimg.cn/img_convert/c1eebe51aabfa1b86aa759a3fb347cba.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=65&id=u85ebdc94&margin=[object Object]&name=image.png&originHeight=157&originWidth=569&originalType=binary&ratio=1&rotation=0&showTitle=false&size=12334&status=done&style=none&taskId=u187fe682-37cb-4c0e-a00d-16dd696d688&title=&width=234.1875)

  • 选择

![image.png](https://img-blog.csdnimg.cn/img_convert/91b67fd3878c1ae2bf8cd4b213957663.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=165&id=ubedc469e&margin=[object Object]&name=image.png&originHeight=457&originWidth=918&originalType=binary&ratio=1&rotation=0&showTitle=false&size=72341&status=done&style=none&taskId=uff967589-fae9-4aab-a4aa-6b318f245a2&title=&width=331)
![image.png](https://img-blog.csdnimg.cn/img_convert/77321d14808c7a613711110208b6e6f8.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=231&id=ue298d98d&margin=[object Object]&name=image.png&originHeight=370&originWidth=551&originalType=binary&ratio=1&rotation=0&showTitle=false&size=23707&status=done&style=none&taskId=u31f95994-51ab-4676-b316-d53997f30c5&title=&width=343.796875)

  • 重复

![image.png](https://img-blog.csdnimg.cn/img_convert/072c73c5e124e0b4ea6eacbaeade6ae7.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=247&id=uec49d88a&margin=[object Object]&name=image.png&originHeight=600&originWidth=973&originalType=binary&ratio=1&rotation=0&showTitle=false&size=62611&status=done&style=none&taskId=uaaba7098-415d-44a1-a484-51ec8fec2f2&title=&width=400)
![image.png](https://img-blog.csdnimg.cn/img_convert/e9386c4b60aac0780dbf10c6d23887aa.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=81&id=ua0fa35f1&margin=[object Object]&name=image.png&originHeight=157&originWidth=781&originalType=binary&ratio=1&rotation=0&showTitle=false&size=19215&status=done&style=none&taskId=ud26a853d-eb9a-439d-b5fa-6e1fe302f38&title=&width=401)

  • 语句级控制结构分析

![image.png](https://img-blog.csdnimg.cn/img_convert/cd74faefe1cf0687662e0c1c0487bc36.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=294&id=u38a9b680&margin=[object Object]&name=image.png&originHeight=368&originWidth=778&originalType=binary&ratio=1&rotation=0&showTitle=false&size=70921&status=done&style=none&taskId=u8034c626-00f1-44e2-a159-40782249e54&title=&width=622.4)

3-单元级控制结构

规定程序单元之间控制流程的机制
![image.png](https://img-blog.csdnimg.cn/img_convert/e6963813f665e34c775ad6fc776f3873.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=239&id=u688b1300&margin=[object Object]&name=image.png&originHeight=299&originWidth=427&originalType=binary&ratio=1&rotation=0&showTitle=false&size=23465&status=done&style=none&taskId=uc25848a9-e8ae-48ea-855c-59c8204e52d&title=&width=341.6)

3-副作用、别名

  • 非局部变量
    一个程序单元可以引用未被本单元说明而被其他单元说明的变量

int a;
int b = 666;
a = 666; —— a为非局部变量 可以这么理解?

  • 非局部变量绑定于其他的程序单元(定义该非局部变量的程序单元)的活动记录中的数据对象;
  • 或非局部变量绑定全局数据区中的数据对象称为非局部环境

![image.png](https://img-blog.csdnimg.cn/img_convert/b414159eac01b4368f63108d8cfe99f8.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=454&id=uc3f41212&margin=[object Object]&name=image.png&originHeight=567&originWidth=800&originalType=binary&ratio=1&rotation=0&showTitle=false&size=64726&status=done&style=none&taskId=u9d6a78d5-bb7f-426e-bad6-09b5fddca7b&title=&width=640)
![image.png](https://img-blog.csdnimg.cn/img_convert/0b5b364fcd9e166abc5dbf17375236f1.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=418&id=u6f5dccb5&margin=[object Object]&name=image.png&originHeight=523&originWidth=894&originalType=binary&ratio=1&rotation=0&showTitle=false&size=52180&status=done&style=none&taskId=ua1223ac1-44de-45ac-a582-37d1fb013ff&title=&width=715.2)
哪俩属于别名?
![image.png](https://img-blog.csdnimg.cn/img_convert/6da799257570f8c12851e297fad88831.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=478&id=u640b86ba&margin=[object Object]&name=image.png&originHeight=598&originWidth=757&originalType=binary&ratio=1&rotation=0&showTitle=false&size=36187&status=done&style=none&taskId=u2af28ad0-420e-4b8f-88a2-f967d813b2c&title=&width=605.6)
![image.png](https://img-blog.csdnimg.cn/img_convert/fadeb4946f80a3e3242b19f0693b21a5.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=458&id=ud28580e6&margin=[object Object]&name=image.png&originHeight=573&originWidth=969&originalType=binary&ratio=1&rotation=0&showTitle=false&size=65953&status=done&style=none&taskId=ua63169b4-23dd-4152-b97b-af667388c66&title=&width=775.2)
![image.png](https://img-blog.csdnimg.cn/img_convert/760c9831aedf7109c5f5fd1666a20943.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=426&id=uc02b90f5&margin=[object Object]&name=image.png&originHeight=532&originWidth=898&originalType=binary&ratio=1&rotation=0&showTitle=false&size=60809&status=done&style=none&taskId=u768a9a27-b237-4404-9fb7-71dd1c83e80&title=&width=718.4)

4-语言的定义

程序设计语言是用来描述计算机所执行的算法的形式表示;
![image.png](https://img-blog.csdnimg.cn/img_convert/f718579c80c1b0c3521ac83556bed5c7.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=118&id=u43109937&margin=[object Object]&name=image.png&originHeight=358&originWidth=1293&originalType=binary&ratio=1&rotation=0&showTitle=false&size=25025&status=done&style=none&taskId=u94151c07-f5dc-4222-b866-185e68a88d0&title=&width=425)
![image.png](https://img-blog.csdnimg.cn/img_convert/f1a8a771a00725f489372bb8191497b2.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=387&id=u3fb896f9&margin=[object Object]&name=image.png&originHeight=597&originWidth=816&originalType=binary&ratio=1&rotation=0&showTitle=false&size=69518&status=done&style=none&taskId=uc404048d-ae12-4117-a249-f2641650355&title=&width=528.7999877929688)
![image.png](https://img-blog.csdnimg.cn/img_convert/a60caebf194b477479b2fc2bea703fba.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=350&id=u2f1657ea&margin=[object Object]&name=image.png&originHeight=437&originWidth=758&originalType=binary&ratio=1&rotation=0&showTitle=false&size=56747&status=done&style=none&taskId=u22960806-f342-46d5-af02-300dc8e81f6&title=&width=606.4)

4-语法描述的基本用途

![image.png](https://img-blog.csdnimg.cn/img_convert/7e76816c8b43164cec47c72560c3654f.png#clientId=ub82bd813-5d31-4&crop=0&crop=0&crop=1&

  • 5
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值