编译原理 阅读(1)

CHAPTER 1 INTRODUCTION

1.1 Language Processors

这一节就是讲是怎么translation的,translation常见的几种。
source program
target program
compiler
interpreter
bytecodes
just-in-time compiler
intermediate program
assembly language
preprocessor

1.2 The Structure of a Compiler

这一节对编译器常见结构进行了简介

大概是个这个图上所有的部分都做了简介

Lexical Analysis
把传进来的程序搞成一组token

x=y+12;
<id,1> <=> <id,2> <+> <12> <;>

lexemes

Syntax Analysis
检查token是不是合法的,顺便把这个搞成一颗由运算符为根的树

大概就是一棵树看一下是不是符合定义的BNF规则
算法貌似两个,一个从根节点递归向下看,一个从叶节点往上推

context-free grammar

Semantic Analysis
重要功能是检查类型合不合法 type checking

Intermediate Code Generation
就是source到target的中间各种转换,常用three-address code

Code Optimization
优化转换出来的code

t1=<id,1>
t2=t1+60
t3=t2
<id,2>=t3
优化
t1 = <id,1> + 60
<id,2> = t1

Code Generation
把中间转换出来的code转化成target code

Symbol-Table Management
存变量信息

<id,1>  对应 x,类型为int,值为xx的变量

optimization
coercions

1.3 Evolution

编译器进化的历史

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值