Compiler Construction 1 Aho Sethi and Ullman Kenneth
- Slides: 23
Compiler Construction 1장
간략한 소개 § Aho, Sethi and Ullman § Kenneth C. Louden § Thomas W. Parsons § 관련 과목 – – – Theories of programming languages Automata theory System programming (including O. S) Assembly language Data structures and File structures Programming techniques 2
Compilers and Interpreters § Compilers – source program compiler target program |__ error messages § Interpreters • source program interpreter result data __| 3
역사 § 컴파일러 역사 – John Backus : FORTRAN compiler – Backus-Naur Form and Algol – N. Wirth : Pascal – C : System programming language – Ada : Language Environment – Java, C#, XML, …. – Perl, Tcl/Tkl 4
인터프리터 § § Basic …. Bill Gates APL … an intolerable complexity Smalltalk … Object oriented languages LISP … lambda calculus …. Incremental programming § Java … for ubiquitous computing, Internet § Embedded systems 5
New paradigm § For Internet, Home computing, Ubiquitous computing, embedded systems and so on § Languages and Compilers that are Small, Smart and Safe § Hybrid approach with concepts of compilers and interpreters – Java, C# § Virtual machine – Free University, Tannenbaum – 개념 설명 6
Java § Simple, Robust, Object-oriented, Platformindependent, multithreaded, dynamic, general-purpose programming environment § Write-once, Run Anywhere § Java virtual machine – Bytes codes : portability and platform independent § Java Runtime Environment 7
Software tools related to compilers § § § Structure editors Pretty printers Static checkers Interpreters Text formatters … tex, nroff, troff Silicon compilers … System on chip – 전자분야 hot issue § Query interpreter § Interpreters for HTML, XML, SGML 9
Skeletal source program preprocessor Source program compiler Target assembly program assembler Relocatable machine code Loader/link-editor library, relocatable object files Absolute machine code Fig. 1. 3. A language-processing system 10
Fig. 1. 9. Phases of a compiler 11
Fig. 1. 10. Translation of a statement 12
Lexical Analysis § Finite state machine Regular expression Regular grammar § Kleen closure § O(n) § Lex § Editor, pattern search § Perl : $x =~ thing 13
Lexical Analysis In a compiler, linear analysis is called lexical analysis or scannning. For example , in lexical analysis the characters in the assignment statement position : = initial + rate * 60 Would be grouped into the following tokens: 1. The identifier position. 2. The assignment symbol : = 3. The identifier initial. 4. The plus sign. 5. The identifier rate. 6. The multiplication sign. 7. The number 60. The blanks separating the characters of these tokens would normally be eliminated during lexical analysis. 14
Syntax Analysis(Parsing) § Push-down automata Context-free grammar § § § BNF(Backus-Naur Form) O(n 3) LL, LR parsing PLs, XML, HTML … Interpretation framework YACC … syntax-directed translation engine
Syntax Analysis assignment statement identifier : = expression + expression identifier expression * expression initial identifier number rete 60 Fig. 1. 4 Parse tree for position : = initial + rate + 60 16
Semantic Analysis § Context-sensitive grammar bounded Turing machine § Unrestricted grammar Turing machine § Unsolvable problem …. Heuristic rules § Type checking, resolving overload, scope rule, binding, …. § Syntax-directed translation engine 17
: = Position : = + initial position * rate + initial 60 * rate inttoreal 60 Fig. 1. 5. Semantic analysis inserts a conversion from integer to real. 18
Code optimization and generation § Speed, space § Data-flow analysis data flow engines § Two pass optimization – Pseudo code level : P-code, Bytes code – Target code level : register allocation, select efficient operations, efficient pipelining … § RISC machine의 실패(? ? ) – Alpha chip § Free University’s approach, down loading § Automatic code generators 19
Fig. 1. 11. The data structure in (b) is for the tree in (a). 20
(1. 3) (1. 4) (1. 5) 21
- Silindrin oturacağının sahəsi
- Characteristics of cluster b personality disorders
- Kavita sethi
- Abha sethi
- Uit rgpv director
- Yacc tutorial
- Cross compiler in compiler design
- Compiler construction: principles and practice
- Compiler construction principles and practice
- Jouni honka-aho
- Aho corasick algorithm
- Weinberger
- Aho corasick algorithm
- Aho-corasick
- Aho-corasick
- Aho-corasick
- Suvi aho
- Al aho
- Al aho columbia
- Sirpa sara-aho
- Type checking in compiler design
- Phases of compiler construction
- Front end and back end in compiler design
- Compiler front end vs back end