Compiling Techniques

Similar documents
UG3 Compiling Techniques Overview of the Course

Overview of the Class

Overview of the Class

Overview of the Course

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

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

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

CS/SE 153 Concepts of Compiler Design

15-411/ Compiler Design

CMPE 152 Compiler Design

CMPE 152 Compiler Design

CS/SE 153 Concepts of Compiler Design

Compilers for Modern Architectures Course Syllabus, Spring 2015

CMPE 152 Compiler Design

CS 526 Advanced Topics in Compiler Construction. 1 of 12

Compiler Architecture for High-Performance Problem Solving

CSCI 565 Compiler Design and Implementation Spring 2014

CS426 Compiler Construction Fall 2006

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

Compilers. Computer Science 431

Generation of High Performance Domain- Specific Languages from Component Libraries. Ken Kennedy Rice University

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

CS 241 Data Organization using C

Principles of Compiler Construction ( )

ECE573 Introduction to Compilers & Translators

Finding People and Information (1) G53CMP: Lecture 1. Aims and Motivation (1) Finding People and Information (2)

Welcome to CSE131b: Compiler Construction

CS 406/534 Compiler Construction Putting It All Together

Compiler Theory Introduction and Course Outline Sandro Spina Department of Computer Science

1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation

G53CMP: Lecture 1. Administrative Details 2016 and Introduction to Compiler Construction. Henrik Nilsson. University of Nottingham, UK

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

1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation

1DL321: Kompilatorteknik I (Compiler Design 1)

Introduction (1) COMP 520: Compiler Design (4 credits) Alexander Krolik MWF 13:30-14:30, MD 279

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

Compiler Design 1. Introduction to Programming Language Design and to Compilation

Object-Oriented Programming CSCI-UA

Principles of Compiler Construction ( )

CSE 333 Lecture 1 - Systems programming

High Performance Computing. Without a Degree in Computer Science

CSC 111 Introduction to Computer Science (Section C)

CSCI 201L Syllabus Principles of Software Development Spring 2018

G.PULLAIH COLLEGE OF ENGINEERING & TECHNOLOGY

Compiler Construction

Usually, target code is semantically equivalent to source code, but not always!

Computer Science Technology Department

ECE 3574: Applied Software Design

Introduction to Programming Languages and Compilers. CS164 11:00-12:30 TT 10 Evans. UPRM ICOM 4029 (Adapted from: Prof. Necula UCB CS 164)

Programming 2. Outline (112) Lecture 0. Important Information. Lecture Protocol. Subject Overview. General Overview.

AE Computer Programming for Aerospace Engineers

Operating Systems, Spring 2015 Course Syllabus

PELLISSIPPI STATE TECHNICAL COMMUNITY COLLEGE MASTER SYLLABUS HPC INTERNETWORKING & GRID TECHNOLOGY HPC 1020

CSE 333 Lecture 1 - Systems programming

Compilers and Interpreters

Hrs Hrs Hrs Hrs Hrs Marks Marks Marks Marks Marks

General Course Information. Catalogue Description. Objectives

Compiling Techniques

Semantic Web Systems Introduction Jacques Fleuriot School of Informatics

CSc 2310 Principles of Programming (Java) Jyoti Islam

Object-Oriented Programming Fall Robert Grimm, New York University

CISC 124: Introduction To Computing Science II

Compiler Construction

ESET 349 Microcontroller Architecture, Fall 2018

Introduction to Databases Fall-Winter 2010/11. Syllabus

Academic Course Description. EM2101 Computer Architecture

CS 241 Data Organization. August 21, 2018

ECE Introduction to Compilers and Translation Engineering

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

AAAF (School of CS, Manchester) Advanced DBMSs / 19

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

CSC116: Introduction to Computing - Java

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

Component Architectures

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

Programming Language Design and Implementation. Cunning Plan. Your Host For The Semester. Wes Weimer TR 9:30-10:45 MEC 214. Who Are We?

The View from 35,000 Feet

CS 525 Advanced Database Organization - Spring 2017 Mon + Wed 1:50-3:05 PM, Room: Stuart Building 111

Compiler Construction LECTURE # 1

Introduction to Databases Fall-Winter 2009/10. Syllabus

CSE 114, Computer Science 1 Course Information. Spring 2017 Stony Brook University Instructor: Dr. Paul Fodor

BOSTON UNIVERSITY Metropolitan College MET CS342 Data Structures with Java Dr. V.Shtern (Fall 2011) Course Syllabus

Intermediate Representations

Evaluation Scheme L T P Total Credit Theory Mid Sem Exam

Spring 2018 NENG 202 Introduction to Computer Programming

CS120 Computer Science I. Instructor: Jia Song

Introduction to Compiler Construction

CMSC433 - Programming Language Technologies and Paradigms. Introduction

CSC116: Introduction to Computing - Java

Inf2C - Computer Systems Lecture 1 Course overview & the big picture

Fundamentals of Database Systems

Constraint Programming. Marco Kuhlmann & Guido Tack Lecture 1

Practical Programming Methodology

Database Systems (INFR10070) Dr Paolo Guagliardo. University of Edinburgh. Fall 2016

CMSC 132: Object-Oriented Programming II. Administrivia

San Jose State University College of Science Department of Computer Science CS151, Object-Oriented Design, Sections 1,2 and 3, Spring 2017

Earlier edition Dragon book has been revised. Course Outline Contact Room 124, tel , rvvliet(at)liacs(dot)nl

CS 132 Compiler Construction

ADMINISTRATIVE MANAGEMENT COLLEGE

CSE 401/M501 Compilers

Transcription:

Lecture 1: Introduction 20 September 2016

Table of contents 1 2 3

Essential Facts Lecturer: (christophe.dubach@ed.ac.uk) Office hours: Thursdays 11am-12pm Textbook (not strictly required): Keith Cooper & Linda Torczon: Engineering a Compiler Elsevier, 2004 Textbook can be reused in UG4 Compiler Optimisation Course website: http://www.inf.ed.ac.uk/teaching/courses/ct/ Discussion forum: https://piazza.com/ed.ac.uk/winter2017/ct/ Action Create an account and subscribe to the course on piazza. Evaluation: no exam, coursework only

Difference from last year Course is now 20 credits Expect much more work Language will be more complex and target will be real machine assembly 3 hours of lectures per week + 1.5 hours labs Extra LLVM-based assignment (use C/C++) Will be taught by visiting Professor from Microsoft Research Very practical knowledge to anyone interested in compiler industry

Coursework There will be two distinct coursework assignments. 1 Write a full compiler from scratch (70% of total mark) Will be written in Java For a subset of C (includes pointers, recursion, structs, memory allocation,...) Backend will target a real RISC assembly Generated code executable in a simulator Three deadlines: week 4 (20%) Parser week 6 (20%) Abstract Syntax Tree (AST) + Semantic Analyser week 9 (30%) Code generator 2 Write a new compiler pass in an existing compiler (30% of total mark) LLVM-based one deadline: week 1 semester 2 (30%)

Coursework is challenging Coursework requires good programming skills Java for 1st assignment + basic knowledge of C C/C++ for 2nd assignment E.g. exceptions, recursion, Java collections classes, inheritance,... Assumes basic knowledge of Unix command line and build system (can be learnt on the fly to some extend) cp, mv, ls,... ant, makefile Git will be used for the coursework (will be learnt on your own)

Coursework marking and labs Automated system to evaluate coursework Mark is a function of how many programs compile successfully Nightly build of your code with scoreboard Will rely on git/bitbucket Action Create an account on http://bitbucket.org send account id via Google form: https://goo.gl/forms/pvah0bmczoqiczu92 mandatory demo; if no demo mark = 0 Labs here to help with coursework in sessions of 1.5 hour Group1 : Friday 15:00-16:30, Forrest Hill, Room 3.D02 Group2 : Friday 16:30-18:00, Forrest Hill, Room 3.D02 Labs start this week and end on week 11.

Coursework is also rewarding You will understand what happens when you type: $ gcc hello.c But also: Will deepened your understanding of computing systems (from language to hardware) Will improve your programming skills Will learn about using revision control system (git)

Class-taking Technique Extensive use of projected material Attendance and interaction encouraged Feedback also welcome Reading book is optional (course is self-content, book is more theoretical) Not a programming course! Start the practical early Help should be sought on Piazza in the first instance

Syllabus Overview Scanning Parsing Abstract Syntax Tree Semantic analysis Code generation Virtual machines (Java) Bytecode Real machines assembly LLVM compiler infrastructure (Aaron Smith from MSR) Advanced topics Instruction selection register allocation

Compilers A program that translates an executable program in one language into an executable program in another language. The compiler might improve the program, in some way. What is an interpreter? A program that directly execute an executable program, producing the results of executing that program Examples: C is typically compiled R is typically interpreted Java is compiled to bytecode, then interpreted or compiled (just-in-time) within a Java Virtual Machine (JVM)

A Broader View Compiler technology = Off-line processing Goals: improved performance and language usability Making it practical to use the full power of the language Trade-off: preprocessing time versus execution time (or space) Rule: performance of both compiler and application must be acceptable to the end user Examples: Macro expansion / Preprocessing Database query optimisation Javascript just-in-time compilation Emulation acceleration: TransMeta code morphing

Why study compilation? Compilers are important system software components: they are intimately interconnected with architecture, systems, programming methodology, and language design Compilers include many applications of theory to practice: scanning, parsing, static analysis, instruction selection Many practical applications have embedded languages: commands, macros, formatting tags Many applications have input formats that look like languages: Matlab, Mathematica Writing a compiler exposes practical algorithmic & engineering issues: approximating hard problems; efficiency & scalability

Intrinsic interest Compiler construction involves ideas from many different parts of computer science Artificial intelligence Algorithms Theory Systems Architecture Software engineering Greedy algorithms Heuristic search techniques Graph algorithms Dynamic programming DFA & PDA, pattern matching Fixed-point algorithms Allocation & naming Synchronisation, locality Pipeline & memory hierarchy management Instruction set Design pattern (visitor) Code organisation

Intrinsic merit Compiler construction poses challenging and interesting problems: Compilers must do a lot but also run fast Compilers have primary responsibility for run-time performance Compilers are responsible for making it acceptable to use the full power of the programming language Computer architects perpetually create new challenges for the compiler by building more complex machines Compilers must hide that complexity from the programmer Success requires mastery of complex interactions

Making languages usable It was our belief that if FORTRAN, during its first months, were to translate any reasonable scientific source program into an object program only half as fast as its hand coded counterpart, then acceptance of our system would be in serious danger.... I believe that had we failed to produce efficient programs, the widespread use of languages like FORTRAN would have been seriously delayed. John Backus (1978)

Next lecture The View from 35000 Feet How a compiler works What I think is important What is hard and what is easy