今生恋露(
网学)贡献
THSS
34100162
2010 / 4301
Principles of Compilation
王朝坤 IISE@Tsinghua
THSS
34100162
2010 / 4301
Chap. 1 Introduction
Chaokun Wang IISE@Tsinghua
Outline
THSS 34100162 2010 / 4301
What
– 什么是编译和编译器
Why Course Info. PL
– 编译与解释的区别和联系
History Contents
编译各阶段的内容
3
1.1 Computer &; Software
THSS 34100162 2010 / 4301
4
Cloud Computing
THSS 34100162 2010 / 4301
Pig Latin
– Pig Latin is a data flow language rather than procedural or declarative. – User code and existing binaries can be included almost anywhere. – Metadata not required, but used when available. – Support for nested types. – Operates on files in HDFS.
5
THSS
34100162
2010 / 4301
6
软件开发
THSS 34100162 2010 / 4301
程序开发工具? ? 如何从编辑器中的文本到可执行程序 的? ?
7
A language-processing system
THSS 34100162 2010 / 4301
8
What is …
THSS 34100162 2010 / 4301
Compilation(编译)
– Compilation is the process whereby one computer language is translated into another (usually simpler and more lowlevel i.e. machine orientated) language – Traditionally, programs in a high-level computer language (e.g. Pascal, C, Lisp) are compiled into assembly language (essentially machine code)
Compiler(编译器)
– The program that does the translation is known as a compiler.
9
Compilers
THSS 34100162 2010 / 4301
Simply stated, a compiler is a program that reads a program written in one language — the source language — and translate it into an equivalent program in another language — the target language. As an important part of this translation process, the compiler reports to its user the presence of errors in the source program.
10
Preprocessors
THSS 34100162 2010 / 4301
Preprocessors produce input to compilers. They may perform the following functions. Macro inclusion. File inclusion. “Rational” preprocessors. Language extensions.
11
Assemblers
THSS 34100162 2010 / 4301
Some compilers produce assembly code that is passed to an assembler for further processing. Other compilers perform the job of the assembler, producing relocatable machine code that can be passed directly to the loader/link-editor. The relationship between assembly and machine code
– Assembly code is mnemonic version of machine code, – names are used instead of binary codes for operations – names are also given to memory address.
12
Loaders and Link-Editors
THSS 34100162 2010 / 4301
Usually, a program called a loader performs the two functions of loading and link-editi
ng. The linker resolves external memory addresses, where the code in one file may refer to a location in another file. The loader then puts together all of the executable object files into memory for execution.
13
1.2 Why is PoC?
THSS 34100162 2010 / 4301
Why Learn it ?
– Computer Science
OS (shell) DBS (
sql) WEB (wsdl, roap)
– Career
Programmer (javac, gcj) Scientist (wm)
Why research it?
– Live
1956~ POPL(1973~)
– Impact
PLDI
14
Why Study Compilers
THSS 34100162 2010 / 4301
Excellent software-engineering example
– theory meets practice.
Essential software tool Influences hardware design
– RISC – VLIW
Tools (mostly “optimization”) for enhancing software reliability and security
– memory leak
15
1.3 General Course Information
THSS 34100162 2010 / 4301
Instructor: Office: Phone: Email: TA: Office: Phone: Email:
王朝坤 FIT-1-105 (Info. Sci. &; Tech. Bldg.) (010) 6279-5393 chaokun@tsinghua.edu 白易元 F