|  | 
 | BIL4023 | Compiler Design | 3+0+0 | ECTS:4 |  | Year / Semester | Fall Semester |  | Level of Course | First Cycle |  | Status | Elective |  | Department | DEPARTMENT of COMPUTER ENGINEERING |  | Prerequisites and co-requisites | None |  | Mode of Delivery | Face to face |  | Contact Hours | 14 weeks - 3 hours of lectures per week |  | Lecturer | Doç. Dr. Hüseyin PEHLİVAN |  | Co-Lecturer | None |  | Language of instruction | Turkish |  | Professional practise ( internship ) | None |  |  |  | The aim of the course: |  | The course aims to describe the various phases of the compiling process, including lexical analysis, top-down and bottom-up parsing, abstract syntax trees, type checking, intermediate translation, basic blocks and code generation, and teach how to implement some compilation phases by using the compiler-compiler tools such as JavaCC and JTB, which can generate source code in Java programming language. | 
 | Learning Outcomes | CTPO | TOA |  | Upon successful completion of the course, the students will be able to : |  |  |  | LO - 1 : | understand the phases of the compilation process. | 1.2 - 1.3 - 2.1 - 5.3 | 1,3 |  | LO - 2 : | write finite automata and grammars for programming language constructs. | 1.2 - 1.3 - 2.1 - 5.3 | 1,3 |  | LO - 3 : | write and execute a scanner, a parser and a type checker for a simple programming language. | 1.2 - 1.3 - 2.1 - 5.3 | 3 |  | LO - 4 : | develop simple programming language interpreters. | 1.2 - 1.3 - 2.1 - 5.3 | 3 |  | LO - 5 : | generate intermediate code for a simple programming language. | 1.2 - 1.3 - 2.1 - 5.3 | 1,3 |  | LO - 6 : | design and implement new programming languages. | 1.2 - 1.3 - 2.1 - 5.3 | 1,3 |  | LO - 7 : | apply compiler techniques to typical software engineering tasks that reading input and taking actions. | 1.2 - 1.3 - 2.1 - 5.3 | 1,3 |  | CTPO : Contribution to programme outcomes, TOA :Type of assessment (1: written exam, 2: Oral exam,  3: Homework assignment, 4: Laboratory exercise/exam, 5: Seminar / presentation,  6: Term paper), LO : Learning Outcome |  |  | 
 | Lexical analysis: Lexical tokens, regular expressions, finite automata, lexical-analyser generators. Parsing: Context-free grammars, predictive parsing, LR parsing, parser generators. Abstract syntax: Semantic actions, abstract parse trees, visitors. Semantic analysis: Symbol tables, type checking. Activation records: stack frames, frames in the MiniJava compiler. Translation to intermediate code: Intermediate representation trees, translation into trees, declaration. Basic blocks and traces: Canonical trees, taming conditional branches. Instruction selection: Algorithms for instruction selection, CISC machines, instruction selection for MiniJava compiler. Liveness analysis: Solution of dataflow equations, liveness in the MiniJava compiler. Register allocation: Coloring by simplification, coalescing, precolored nodes, graph-coloring implementation, register allocation for trees. Code generation: Putting it all together. |  |  | 
 | Course Syllabus |  | Week | Subject | Related Notes / Files |  | Week 1 | Introduction to Translators |  |  | Week 2 | Lexical Analysis |  |  | Week 3 | Syntax Analysis (Parsing) |  |  | Week 4 | Abstract Ayntax |  |  | Week 5 | Semantic Analysis |  |  | Week 6 | Activation Records |  |  | Week 7 | Translation to Intermediate Code |  |  | Week 8 | Basic Blocks and Traces |  |  | Week 9 | Mid-term exam |  |  | Week 10 | Instruction Selection |  |  | Week 11 | Liveness Analysis |  |  | Week 12 | Register Allocation |  |  | Week 13 | Code Generation |  |  | Week 14 | Dataflow Analysis |  |  | Week 15 | Loop Optimizations |  |  | Week 16 | End-of-term exam |  |  |  | 
 | 1 | Appel, A. W., 2002; Modern Compiler Implementation in Java, 2nd ed., Cambridge University Press, 501 p. |  |  |  | 
 | 1 | Cooper, K., Torczon, L. 2003; Engineering a Compiler, 1st ed., Morgan Kaufmann, 801 p. |  |  | 2 | Grune, D., Bal, H., Jacobs, C., Langendoen, K. 2000; Modern Compiler Design, Wiley, 736 p. |  |  |  | 
 | Method of Assessment |  | Type of assessment | Week No | Date | Duration (hours) | Weight (%) |  | Mid-term exam | 9 | 26/11/2023 | 2 | 50 |  | End-of-term exam | 16 | 24/01/2024 | 2 | 50 |  |  | 
 | Student Work Load and its Distribution |  | Type of work | Duration (hours pw) | No of weeks / Number of activity | Hours in total per term |  | Yüz yüze eğitim | 3 | 14 | 42 |  | Sınıf dışı çalışma | 1 | 14 | 14 |  | Arasınav için hazırlık | 6 | 1 | 6 |  | Arasınav | 2 | 1 | 2 |  | Dönem sonu sınavı için hazırlık | 8 | 1 | 8 |  | Dönem sonu sınavı | 2 | 1 | 2 |  | Total work load |  |  | 74 | 
 |