第一章 引 论

36
编编编编 编编编编编编编编编编编编编 编编编

Upload: brittany-herring

Post on 31-Dec-2015

116 views

Category:

Documents


0 download

DESCRIPTION

第一章 引 论. 编译原理. 南京大学计算机科学与技术系 戴新宇. 课程概要. 戴新宇 [email protected] 学时 : 70 学时 ( 课堂 ) 学分: 4 周二 : 2-4pm , 周五 10-12am 仙 I - 103 教材:编译原理(龙书第二版) 讲义: http:// cs.nju.edu.cn / dxy / compiler.htm 助教 : 解 定宝 [email protected] 胡光能 [email protected]. 编译? 他能做什么?. 了解 编译器 设计的原理和技术. - PowerPoint PPT Presentation

TRANSCRIPT

[email protected]()4: 8-10am 10-12am II-212http://cs.nju.edu.cn/dxy/compiler.htm: [email protected] [email protected]

compiler

C++ C Python C

vs. vs. Java

Javac Hello.javaJava HelloC

CompilerObject file (.o .obj .dcu)LinkerAssemblerlibraries (.lib)assembly file (.a .asm)executable file (.exe)source file (.c .pas )OS (.dll, .so)Loaderprocess vs. Analysis - - front endSynthesisback end

lexical analysis, scanning

/(lexeme) token-nameattribute-value/position = initial + rate * 60 syntax analysis/parsing

/syntax tree

(Semantic Analysis)(meaning)

(Interesting examples)Jack said Jerry left his assignment at home.

Jack said Jack left his assignment at home?

compiler@stanford 19(Intermediate-Code Generation)t1 = inttofloat(60) t2 = id3 * t1; t3 = id2 + t2;

(Code Optimization)

(Code Generation)

Pass vs. : lex/flex yacc/bison-Fortran, Pascal, Lisp, Modula, CNOMAD, SQL, PostscriptPrologOPS5

Simula, Smalltalk, Modula3, C++, Object Pascal, Java, C#

1///RISC2///

1/Javastaticxxxx2

3CC/publicprivateprotected

4

5 (call by value)/(call by reference)