Principles of Compiler Construction ( )

Similar documents
Principles of Compiler Construction ( )

INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10

understanding recursive data types, recursive functions to compute over them, and structural induction to prove things about them

cmpt 440/821 Advanced Topics in Programming Languages

Compilers for Modern Architectures Course Syllabus, Spring 2015

CS/SE 153 Concepts of Compiler Design

CMPE 152 Compiler Design

CMPE 152 Compiler Design

CS/SE 153 Concepts of Compiler Design

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus

COSE212: Programming Languages. Lecture 0 Course Overview

CMPE 152 Compiler Design

San José State University College of Science/Department of Computer Science CS152, Programming Paradigms, Sections 3 & 4, Fall Semester, 2016

CS 415 Midterm Exam Spring 2002

Compilers. Computer Science 431

San José State University College of Science/Department of Computer Science CS152, Programming Paradigms, Sections 1 & 2 Spring Semester, 2018

CSCI 565 Compiler Design and Implementation Spring 2014

San José State University College of Science/Department of Computer Science CS152, Programming Paradigms, Sections 1 & 2, Fall Semester, 2017

Overview of the Class

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

Compiler Construction

CS 536. Class Meets. Introduction to Programming Languages and Compilers. Instructor. Key Dates. Teaching Assistant. Charles N. Fischer.

San José State University College of Science/Department of Computer Science CS 152, Programming Language Paradigms, Section 03/04, Fall, 2018

Overview of the Class

HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS

ECE573 Introduction to Compilers & Translators

Principles of Programming Languages [PLP-2015] Detailed Syllabus

Compiling Regular Expressions COMP360

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

CS 6371: Advanced Programming Languages

Compiler Design. Dr. Chengwei Lei CEECS California State University, Bakersfield

Beijing Jiaotong University CS-23: C++ Programming Summer, 2019 Course Syllabus

San José State University Department of Computer Science CS-144, Advanced C++ Programming, Section 1, Spring 2018

Syllabus COSC-051-x - Computer Science I Fall Office Hours: Daily hours will be entered on Course calendar (or by appointment)

CS Compiler Construction West Virginia fall semester 2014 August 18, 2014 syllabus 1.0

CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers

G.PULLAIH COLLEGE OF ENGINEERING & TECHNOLOGY

CS 415 Midterm Exam Fall 2003

CS 241 Data Organization using C

CS 415 Midterm Exam Spring SOLUTION

Database Systems Management

Questions to ask yourself in preparation for tests and quizzes

CS202 Compiler Construction. Christian Skalka. Course prerequisites. Solid programming skills a must.

Lecture 1 (Part 1) Introduction/Overview

CS415 Compilers Overview of the Course. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CS2013 Course Syllabus Spring 2018 Lecture: Mon/Wed 2:00 P.M. 2:50 P.M. SH C259 Lab: Mon/Wed 2:50 P.M. 4:00 P.M. SH C259

San Jose State University - Department of Computer Science

Evaluation Scheme L T P Total Credit Theory Mid Sem Exam

CS 240 Fall 2015 Section 004. Alvin Chao, Professor

Programming Languages and Compilers (CS 421)

ET345P Control Systems [Onsite]

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA.

Oklahoma State University Institute of Technology Face-to-Face Common Syllabus Fall 2017

Overview of the Course

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

San José State University Department of Computer Science CS-144, Advanced C++ Programming, Section 1, Fall 2017

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10

San José State University Department of Computer Science CS-174, Server-side Web Programming, Section 2, Spring 2018

CSC 111 Introduction to Computer Science (Section C)

Compiler Construction Lecture 1: Introduction Summer Semester 2017 Thomas Noll Software Modeling and Verification Group RWTH Aachen University

Compiling Techniques

CST-402(T): Language Processors

General Course Information. Catalogue Description. Objectives

CS503 Advanced Programming I CS305 Computer Algorithms I

Class Information ANNOUCEMENTS

Compiler Construction Lecture 1: Introduction Winter Semester 2018/19 Thomas Noll Software Modeling and Verification Group RWTH Aachen University

CSc 2310 Principles of Programming (Java) Jyoti Islam

Syllabus CSCI 405 Operating Systems Fall 2018

CS 4120 and 5120 are really the same course. CS 4121 (5121) is required! Outline CS 4120 / 4121 CS 5120/ = 5 & 0 = 1. Course Information

Compulsory course in Computer Science

PLAGIARISM. Administrivia. Compilers. CS143 11:00-12:15TT B03 Gates. Text. Staff. Instructor. TAs. Office hours, contact info on 143 web site

ITE 205 Software Design and Programming I

CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

San José State University Department of Computer Science CS151, Section 04 Object Oriented Design Spring 2018

Translator Design CRN Course Administration CMSC 4173 Spring 2017

Computer Science Student Advising Handout Idaho State University

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, Pilani Pilani Campus Instruction Division

List of Figures. About the Authors. Acknowledgments

CS 3230 Object Oriented UI Development With Java Syllabus

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram

CS 432 Fall Mike Lam, Professor. Compilers. Advanced Systems Elective

San José State University Computer Science Department CS49J, Section 3, Programming in Java, Fall 2015

BSCS Fall Mid Term Examination December 2012

Compiler Construction

CS 242. Fundamentals. Reading: See last slide

Compiler Code Generation COMP360

Important Project Dates

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

Static Program Analysis

Static Program Analysis

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

Course introduction. Advanced Compiler Construction Michel Schinz

ECE Introduction to Compilers and Translation Engineering

Name of chapter & details

Lecture I: Introduction and Overview

CSE 504: Compiler Design

Red Hat Certified Engineer (RH300) 50 Cragwood Rd, Suite 350 South Plainfield, NJ 07080

CSC 172 Data Structures and Algorithms. Fall 2017 TuTh 3:25 pm 4:40 pm Aug 30- Dec 22 Hoyt Auditorium

Operating Systems, Spring 2015 Course Syllabus

Transcription:

Principles of Compiler Construction ( ) Dr Mayer Goldberg October 25, 2017 Contents 1 Course Objectives 1 2 Course Requirements 2 3 Detailed Syllabus 3 4 Computation of grade 6 5 References 6 Course number: 201-1-2061 Mandatory for undergraduate CS and SE students Credits: 4.5 Course site: http://www.cs.bgu.ac.il/~comp181/ Prerequisites: Principle of Programming Languages (202-1-2051), Automata & Formal Languages (202-1-2011), Architecture (202-1-3041) 1 Course Objectives Gain additional insight into programming languages, building on what students have learned in the Principles of Programming Languages course. Understand the major components of the compiler: Syntactic analysis, semantic analysis, code generation, and the run-time environment. Gain hands-on experience in crafting these components. 1

Learn about compiler optimizations: What compilers do to generate code that is faster, shorter, and performs better. Implement many of these optimizations, and see how they improve the code. Be able to apply information & skills learned in the compilers course to other areas in computer science where syntactic and semantic analysis, code generation, and translation are needed. 2 Course Requirements 26 2-hours lectures 13 1-hours exercise sessions 4 homework assignments [10% of the grade] Written problems in scanning and parsing theory Programming assignments building stages of the compiler, implementing various optimizations, and various exercises in code transformation & translation. Final project: Writing a code generation, and integrating the previouslywritten stages of the compiler into a self-contained, working compiler from Scheme to native x86 assembly. [30% of the grade]: This component is mandatory Midterm exam [15% of the grade] Online quizzes [5% of the grade] Final exam [40% of the grade]: This component is mandatory In this course, for a component of your final grade to be mandatory means that you shall fail the course if you fail this component: If you fail the final exam, you shall fail the course. If you fail the final project, you shall fail the course. 2

2.1 Homework Guidelines The programming assignments may be submitted singly or in pairs. Of the three programming assignments, only the two highest grades will count toward the final grade. Late submissions without prior written authorization from a course staff member will receive a grade of zero (0). All assignment will be graded using Chez Scheme on the Linux image on the departmental lab computers only. 3 Detailed Syllabus 3.1 Introduction to Compiler Construction References: 1, 3, 4, 5 The algebraic relationship between compilation & interpretation. Cross-compilation, boot strapping a compiler, de-compilation. The stages of the compiler: What work is done in each, what kinds of errors can and cannot be detected at each, the basic algorithms that are implemented at each stage. Dynamic vs statically-typed languages. Early binding vs late binding. The information available to the compiler for translation, error detection, and optimizations. 3.2 Scanning & Parsing Theory References: 1, 2, 5 Scanner: DFA, NDFA, NDFA with ϵ-transitions Parsing: Top-down, recursive descent parsers, parsing combinators, bottom-up parsers Hand-coding various parsers Using parser-generation tools in C & Java Macro expansion: Syntactic transformations, reduction to core forms in the language, variables, meta-variables and syntactic hygiene. 3

3.3 Programming Languagues References: 2, 3 Functional vs Imperative programming: How change & side-effects are understood & modelled in the functional view of programming. Parameter-passing mechanisms: Call-by-value, call-by-reference, callby-sharing/object, call-by-name, call-by-need. Features of the various parameter-passing mechanisms, their motivation, history & implementation. Scope & its implementation: Dynamic scope (deep binding, shallow binding), lexical scope. Dynamic scope and the implementation of exception handling. The structure of the lexical environment, and the implications for data sharing & side effects. Object-oriented vs functional programming Languagues. The structure of the closure compared to that of the object. Mapping of lambdaexpressions to objects. The virtual method table. Monads & monadic programming. 3.4 Continuation-Passing Style (CPS) References: 2, 5 CPS as a programming technique (multiple return values, multiple continuations, co-routines, implementation of threads. CPS as an approach to writing a compiler: CPS, defunctionalization of the continuation, stack machine. CPS as an intermediate language for the compiler: Optimizations that are simpler in CPS. 3.5 Semantic Analysis References: 3, 4, 5 Lexical addressing, debruijn numbering 4

Identification of tail calls Boxing, data indirection, and motion from the stack to the heap: A comparison between quasi-functional programming languages (Scheme, LISP) and object oriented programming languages (Java). 3.6 Code Generation References: 1, 2, 3, 4 Layout of Scheme objects in memory. Run-time type information. Comparison with the situation in object-oriented programming languages. An overview of the proof of correctness of the compiler, and how it is constructed along with the code generator. Optimization of tail calls Code generation to native x86 instructions for the various expressions in our language The primitive procedures & support code that are provided with the compiler 3.7 The Run-Time Environment References: 2, 3, 4 The top level: n-lisp value cells, function cells, property cells, etc. Dynamic memory management: Reference counting Garbage collection: mark & sweep, stop & copy, generational garbage collection Namespaces, modules, and their implementation 5

3.8 Compiler Optimizations References: 1, 2, 3, and notes The tail-recursion & tail-call optimizations Loop optimizations & transformations Array optimizations Strength reduction optimizations Dead-code removal, write-after-write optimizations Common Sub-expression Elimination, both as a high-level and lowlevel optimization Optimizations for super-pipelined and parallel architectures 4 Computation of grade The components of the uncurved, final grade are as follows: component weight homeowrk 10% online quizzes 5% midterm quiz 15% final project 30% final exam 40% The mandatory components in this course are the final project and the final exam. This means that you cannot pass this course if you fail any of these components. Curving aims at setting the grades on a common scale. Curving in this course is optional, and at the discretion of the instructors. Curving can be done either up or down. The curving function need not be constant or linear, but it will be monotonic over the relevant interval. 5 References 1. Textbook: Modern Compiler Design, by D. Grune, H. Bal, C. Jacobs, K. Langendoen 6

2. LISP in Small Pieces, by Christian Queinnec 3. The Anatomy of LISP, by John Allen 4. The Structure & Interpretation of Computer Programs, by Harold Abelson, et al. 5. Essentials of Programming Languages, by Daniel P. Friedman, Mitchell Wand, Christopher T. Haynes 7