首页 > 学院 > 开发设计 > 正文

编译原理 阅读(1)

2019-11-08 19:59:56
字体:
来源:转载
供稿:网友

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+60t3=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

编译器进化的历史


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表