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

CS/SE 153 Concepts of Compiler Design

CS 415 Midterm Exam Spring 2002

COSE212: Programming Languages. Lecture 0 Course Overview

CMPE 152 Compiler Design

CMPE 152 Compiler Design

CSCI 565 Compiler Design and Implementation Spring 2014

CS/SE 153 Concepts of Compiler Design

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

Compiling Regular Expressions COMP360

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

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

CMPE 152 Compiler Design

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

Compiler Construction

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

Principles of Programming Languages [PLP-2015] Detailed Syllabus

Overview of the Class

Compilers for Modern Architectures Course Syllabus, Spring 2015

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

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

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

CS 415 Midterm Exam Fall 2003

CS 415 Midterm Exam Spring SOLUTION

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

Questions to ask yourself in preparation for tests and quizzes

G.PULLAIH COLLEGE OF ENGINEERING & TECHNOLOGY

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

Compilers. Computer Science 431

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

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

CST-402(T): Language Processors

Compiling Techniques

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

Compiler Construction

Evaluation Scheme L T P Total Credit Theory Mid Sem Exam

Overview of the Course

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

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

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

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview

KALASALINGAM UNIVERSITY ANAND NAGAR, KRISHNAN KOIL DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING ODD SEMESTER COURSE PLAN

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

Compiler Code Generation COMP360

CS 242. Fundamentals. Reading: See last slide

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

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

Course introduction. Advanced Compiler Construction Michel Schinz

Programming Languages and Compilers (CS 421)

ECE573 Introduction to Compilers & Translators

COLLEGE OF ENGINEERING, NASHIK. LANGUAGE TRANSLATOR

Lexical Scanning COMP360

LECTURE NOTES ON COMPILER DESIGN P a g e 2

INF5110 Compiler Construction

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

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

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

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

CS 6371: Advanced Programming Languages

List of Figures. About the Authors. Acknowledgments

COP 3402 Systems Software. Lecture 4: Compilers. Interpreters

CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures. Dan Grossman Autumn 2018

CSC 111 Introduction to Computer Science (Section C)

Compilers. Prerequisites

BSCS Fall Mid Term Examination December 2012

Compiler Construction

Programming Languages Third Edition. Chapter 7 Basic Semantics

UNIVERSITY OF SOUTH ALABAMA COMPUTER SCIENCE

CS 406/534 Compiler Construction Putting It All Together

Name of chapter & details

Lecture 1 (Part 1) Introduction/Overview

Compiler Construction I

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

Compilers and Interpreters

Introduction to Compiler Construction

Static Program Analysis

ECE Introduction to Compilers and Translation Engineering

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF CSE COURSE PLAN

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Static Program Analysis

Torben./Egidius Mogensen. Introduction. to Compiler Design. ^ Springer

Class Information ANNOUCEMENTS

Compiler Design. Computer Science & Information Technology (CS) Rank under AIR 100

Group B Assignment 9. Code generation using DAG. Title of Assignment: Problem Definition: Code generation using DAG / labeled tree.

Outline. Programming Languages 1/16/18 PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY. Current

ICS 252 Introduction to Computer Design

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573

SLIDE 2. At the beginning of the lecture, we answer question: On what platform the system will work when discussing this subject?

GUJARAT TECHNOLOGICAL UNIVERSITY

CS 132 Compiler Construction

General Course Information. Catalogue Description. Objectives

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

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND ENGINEERING COURSE PLAN

Programming Languages (PL)

Compiler construction

Programming Languages FILS Andrei Vasilateanu

Transcription:

Principles of Compiler Construction ( ) Dr Mayer Goldberg September 5, 2016 Contents 1 Course Objectives 1 2 Course Requirements 2 3 Detailed Syllabus 3 4 References 6 Course number: 201-1-2061 Mandatory for undergraduate CS and SE students Credits: 4.5 Course site: http://www.little-lisper.org/website/comp.html 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 2-hours exercises sessions 4 homework assignments [15% 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. About 30 hours each, done singly or in pairs. Final project: Writing a code generation, and integrating the previouslywritten stages of the compiler into a self-contained, working compiler from Scheme to CISC assembly. About 100 hours, done singly or in pairs. [15% of the grade]: This component is mandatory Midterm exam [15% of the grade] Final exam [55% 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. Here are some examples: If you fail the final exam, you shall fail the course. If you fail the final project, you shall fail the course. If you fail the midterm, but your cumulative grade in the course is 56 or higher, then you shall pass the course. 2

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 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. 3

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 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. 4

An overview of the proof of correctness of the compiler, and how it is constructed along with the code generator. Code generation for the various expressions in our language Optimization of tail calls 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 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 5

4 References 1. Textbook: Modern Compiler Design, by D. Grune, H. Bal, C. Jacobs, K. Langendoen 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 6