HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS Code : 6COMTHEORY Prerequisite : 6AMATA Credit : 3 s (3 hours LEC) Year Level: 3 rd year Degree Program : Bachelor of Science in Computer Science (BSCS) Description : This course studies the principles of programming languages with an emphasis on programming language implementation and compiler design. This includes various techniques for describing and defining a language, as well as techniques for implementing compilers. The course is centered on a large programming project-the construction of a complete compiler for a small programming language. s to be covered over the two terms include: lexical analysis, syntactic analysis, recursive descent parsing, LR parsing, syntax-directed translation, type checking, run-time environments, code generation, code optimization, and various language design issues. At the end of the course, students will be able to: s Graduate s Aligned to C1 Given a basic compiler definition, students can decide the corresponding compiler structure and identify the relationships among different phases of the compiler (1) Lexical Analyzer (2) Syntax Analyzer (3) Semantic Analyzer (4) Intermediate Code Generator (5) Machine Code Optimizer (6) Code Generator C2 Understand how a compiler works, specifically the analysis of a program into atomic pieces and the subsequent synthesis into an equivalent program BSCS01: Apply knowledge of computing fundamentals, knowledge of a computing specialization, and mathematics, science, and domain knowledge appropriate for the computing specialization to the abstraction and conceptualization of computing models from defined problems and requirements. BSCS02: Identify, analyze, formulate, research literature, and solve complex computing problems and requirements reaching substantiated conclusions using fundamental principles of mathematics, computing sciences, and relevant domain disciplines BSCS02: Identify, analyze, formulate, research literature, and solve complex computing problems and requirements reaching substantiated conclusions using fundamental principles of mathematics, computing sciences, and relevant domain disciplines Page 1 of 8
C3 Construct a complete working compiler using a specific language that students have designed BSCS03: Design, implement, and evaluate computer-based systems, processes, components, or programs to meet desired needs and requirements under various constraints. Evidences As proof of achievement of the above-mentioned outcomes, the student is required to complete and submit the following: LE1: Machine Project LE1.1 Lexical Analyzer/Scanner LE1.2 Syntax and Semantic Analyzer LE1.3 Build a Compiler CO1, CO2 CO1, CO2 CO1, CO2, CO3 Measurement System: To assess the level of performance in the learning evidences, the following rubrics will be used: LE1: Machine Project Area to Assess Point Value Codes 50 Efficiency 10 Usability 10 Robustness 10 User Interface 5 Correct 10 Run without Error 5 Presentation 25 Organization 10 Delivery 5 Group Dynamics 5 Completeness 5 Individual Grade 25 Attitude 5 Contribution 10 Participation 10 Total 100 Page 2 of 8
Plan: Define what is a compiler and its scheme Comparison of interpreters and compilers, language translation phases, machinedependent and independent aspects of translation, language translation 1-5 CO1, CO2 Overview of Compiler Design Architecture of Compiler Design Lecture Discussion Oral Recitation Brainstorming Mastery test (oral/written) Assignment Seatwork (Problem Solving) Lexical Analyzer / Scanner (LE1.1) Learn the different phases of compiler Phases of Compiler Study and analyze the application of regular expressions and its components in lexical scanners Lexical Analysis: definition Tokens Specification of Tokens Regular Expression (RE) Operations Notations Precedence/Associativity Page 3 of 8
Recognize and analyze the implementation of finite state automata in lexical analysis finite state automata Know the use of derivations in syntax analyzer Syntax Analysis: Context Free Grammar Syntax Analyzer Derivations (Left-Most and Right- Most) 6 Prelim Examination Create parse trees, first and follow sets in syntax analysis Know the limitations of syntax analyzers 7-11 Syntax Analysis: Parse Tree First and Follow Sets Limitations of Syntax Analyzer Lecture Discussion Oral Recitation Brainstorming Mastery test (oral/written) Assignment Seatwork (Problem Solving) Syntax and Semantic Analyzer (LE1.2) Know the different parsing techniques and learn the basic concepts Types of Parsing Top-Down parsing: Definition and concepts Bottom-Up parsing: Definition and concepts Distinguish the Types of Top-Down Page 4 of 8
different top-down parsing and their basic concepts parsing Recursive Descent Parsing - Backtracking - Non Backtracking o Predictive Parser o LL parser Learn the different bottomup parsing and their basic concepts Types of Bottom-Up parsing Shift-Reduce LR Parsing - SLR parsing - LR Parser - LALR Parser Identify the different kind of errors, error detection and recovery strategies Kind of Errors - Lexical - Syntactical - Semantical - Logical Common Error-recovery strategies - Panic Mode - Statement Mode - Error Productions - Global Corrections Define the AST, its use in semantic analysis and how it reveals the Abstract Syntax Trees Semantics: definition Semantic Error Attribute Grammar Page 5 of 8
lexical/syntactical structure of the program S-Attribute SDT L-Attribute SDT 12 Midterm Examination Intermediate Representation, code generation and object code, implementation of code generators 13-17 Runtime Environment Activation Trees Storage Allocation Static Allocation Stack Allocation Heap Allocation Parameter Passing Pass by Value/reference Pass by Name/copyrestore Lecture Discussion Oral Recitation Brainstorming Mastery test (oral/written) Assignment Seatwork (Problem Solving) Build a compiler (LE1.3) Code generation: code generation by tree walking; context sensitive translation Identify and analyze the Code optimization: Machineindependent Symbol table Implementation Scope Management Intermediate Code Generation - Representation - Three Address Code Declarations Code Optimization - Machine Independent Page 6 of 8
optimization; data-flow analysis; loop optimizations; machinedependent optimization - Machine Dependent - Loop - Dead-Code Elimination - Partial Redundancy 18 Final Examination References: A. Published Materials Compiler Construction: Principles and Practices by Kenneth C. Louden (1998) Compiler Construction by William Waite (1996) Compiler Construction by Niklaus Wirth (1996) Compiler Design: Theory, Tools and Examples by Seth Bergmann (1994) Elements of Compiler Design by Alexander Meduna (2007) Basics of Compiler Design by Torben Ægidius Mogensen (2010) Compilers: Principles, Techniques and Tools by Alfred V. Aho et. Al (2006) B. Web References http://www.tutorialspoint.com/compiler_design/ (Learn Compiler Design) http://www.cs.man.ac.uk/~pjj/farrell/compmain.html (Compiler Basics) http://www.cs.rit.edu/~ats/cc-2010-2/tutorial/ (Compiler Construction Tutorial) http://web.stanford.edu/class/archive/cs/cs143/cs143.1128/ (Compilers) Page 7 of 8
Grading System The final grade in this course will be composed of the following items and their weights in the final grade computation: Class Standing 70% Major Exam 30% FINAL GRADE = Class Standing + Major Exam Transmutation Table: Minimum Passing Percent Average of Subject : 50 RANGE EQUIVALENTS (COMPUTED AVERAGES & TRANSMUTED VALUES) Range of Computed Average Range of Transmuted Values Grade General Classification 94.0000 100.0000 97 100 1.00 Outstanding 88.0000 93.9999 94 96 1.25 Excellent 82.0000 87.9999 91 93 1.50 Superior 76.0000 81.9999 88 90 1.75 Very Good 70.0000 75.9999 85 87 2.00 Good 64.0000 69.9999 82 84 2.25 Satisfactory 58.0000 63.9999 79 81 2.50 Fairly Satisfactory 52.0000 57.9999 76 78 2.75 Fair 50.0000 51.9999 75 3.00 Passed Below Passing Average 5.00 Failed Failure due to absences 6.00 FA Unauthorized Withdrawal 8.00 UW Officially Dropped 9.00 Dropped Page 8 of 8