Philadelphia University Faculty of Information Technology Department of Computer Science Second semester, 2014/2015 Course Syllabus Course Title: Compiler Construction Course code: 750324 Course prerequisite (s) and/or co requisite (s): Course Level: 3 (751323) + (750321) Lecture Time: 11:10-12:00 Credit hours: 3 Academic Staff Specifics Name Rank Office Office Hours E-mail Address S,T,T Maouche Associate Mourad Professor IT602 13-14 mmaouch@philadelphia.edu.jo M, W 10-11 Course module description: This module aims to show how to apply the theory of language translation introduced in the prerequisite courses to build compilers and interpreters. It covers the building of translators both from scratch and using compiler generators. In the process, the module also identifies and explores the main issues of the design of translators. Topics include compiler design, lexical analysis, parsing, symbol tables, declaration and storage management, code generation, and optimization techniques. The construction of a compiler/interpreter for a small language is a necessary component of this module, so students can obtain the necessary skills. Course module objectives: The course aims to: 1- To understand the structure of compilers. 2- To explain the basic techniques used in compiler construction such as lexical analysis, top-down, bottom-up parsing, context-sensitive analysis, and intermediate code generation. 3- To understand the basic data structures used in compiler construction such as abstract syntax trees, symbol tables, three-address code, and stack machines. 4- To design and implement a compiler using a software engineering approach. 1 Course/ module components Books (title , author (s), publisher, year of publication) Title: Compilers Principles, Techniques and Tools Author(s)/Editor(s): Alfred V. Aho, Ravi Sethi and Jeffry D. Ulman Publisher: Addison Wesley Longman, 2007 ISBN: 0- 201- 10088- 6 Support material (s) (vcs, acs, etc). Study guide (s) (if applicable) Homework and laboratory guide (s) if (applicable). Teaching methods: Lectures, discussion groups, tutorials Duration: 15 weeks, 45 hours in total Lectures: 30 hours (2 per week) Tutorials: 13 hours, 1 per week (except the last two weeks) Seminars: 2 hours, (1 per week for the last two weeks) Learning outcomes: Knowledge and understanding o Increase students’ knowledge of the structure of compilers o Be familiar with different kinds of translators o Understand how do compiler work o Be familiar with lexical analysis, syntax analysis, static type checking, code generation and optimization techniques Cognitive skills (thinking and analysis). o Design and build a compiler for a simplified programming language o Communication skills (personal and academic). o Plan and undertake a major individual project, and prepare and deliver coherent and structured verbal and written technical report. o Be able to display an integrated approach to the deployment of communication skills, use IT skills and display mature computer literacy, strike the balance between self-reliance and seeking help when necessary in new situations, and display personal responsibility by working to multiple in complex activities Practical and subject specific skills (Transferable Skills). . o Be able to code concepts in compiler phases. o Be able to use compiler construction tools (parsers, generators for scanners...) Assessment instruments Short reports and/ or presentations, and/ or Short research projects Quizzes.& Home works Final examination: 50 marks 2 Allocation of Marks Assessment Instruments Mark First examination 20 Second examination 20 Final examination: 40 marks 40 Reports, research projects, Quizzes, Home works, Projects Total 20 100 Assignments All assignments will be announced or handed out in class. Many assignments will require programming in Python. All individual assignments, whether programming or not, are to be done individually. While you may discuss the assignment in general terms with others, your solutions should be composed, designed, written and tested by you alone. If you need help, consult the TA or the instructor. Documentation and academic honesty Documentation style (with illustrative examples) Protection by copyright Avoiding plagiarism. Course/module academic calendar week (1) (2) (3) (4) (5) (6) First exam. (7) (8) (9) (10) Basic and support material to be covered Homework/reports and their due dates Introduction to Compilers: The role of language translation in the programming process; Comparison of interpreters and compilers, language translation phases, machine dependent and machine independent aspects of translation, language translation as a software engineering activity Lexical Analysis: Application of regular expressions in lexical scanners, Lexical Analysis: hand coded scanner vs. automatically generated scanners Lexical Analysis: formal definition of tokens, implementation of finite state automata. Syntax Analysis: Revision of formal definition of grammars, BNF and EBNF; bottom up vs. top down parsing, Syntax Analysis: tabular vs. recursive descent parsers, error handling, Parsers Implementation: automatic generation of tabular parsers, symbol table management, the use of tools in support of the translation process Semantic Analysis: Data type as set of values with set of operations, data types, type- checking models, semantic models of user defined types, parametric polymorphism, subtype polymorphism, type checking algorithms. Intermediate Representation, code generation: Intermediate and object code, intermediate representations, implementation of code generators Code generation: code generation by tree walking; context sensitive translation, register use. 3 Implementation of a lexical analyzer Implementation of a basic parser (11) Second exam. (12) (13) (14) (15) (16) Final Exam. Code optimization: Machine independent optimization; data-flow analysis; loop optimizations; machine dependent optimization Error Detection and Recovery Error Repair, Compiler Implementation Compiler design options and examples: C Compilers C++, Java, and YACC Compilers Implementation of a type checking system Implementation of an intermediate code generator Revision Expected workload: On average students need to spend 2 hours of study and preparation for each 50-minute lecture/tutorial. Attendance policy: Absence from lectures and/or tutorials shall not exceed 15%. Students who exceed the 15% limit without a medical or emergency excuse acceptable to and approved by the Dean of the relevant college/faculty shall not be allowed to take the final examination and shall receive a mark of zero for the course. If the excuse is approved by the Dean, the student shall be considered to have withdrawn from the course. Module references Books Students will be expected to give the same attention to these references as given to the Module textbook(s) 1- W. Appel, Modern Compiler Implementation in Java, Prentice Hall, 2002 2- D. Watt, Brown, Programming Language Processors in Java: Compilers and Interpreters, Prentice hall, 2000 3- Keith Cooper, Linda Torczon, Engineering a Compiler, Imprint: Morgan Kaufmann, 2011, ISBN: 978-0-12-088478-0 4