Project: ACM Compiler 2014 Shanghai Jiao Tong University Class ACM 2011 Dong Xie.

Slides:



Advertisements
Similar presentations
Introduction to Compiler Construction
Advertisements

Abstract Syntax Mooly Sagiv html:// 1.
1 JavaCUP JavaCUP (Construct Useful Parser) is a parser generator Produce a parser written in java, itself is also written in Java; There are many parser.
Lecture 01 - Introduction Eran Yahav 1. 2 Who? Eran Yahav Taub 734 Tel: Monday 13:30-14:30
Recap Mooly Sagiv. Outline Subjects Studied Questions & Answers.
1 Semantic Processing. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
Abstract Syntax Trees Compiler Baojian Hua
Reference Book: Modern Compiler Design by Grune, Bal, Jacobs and Langendoen Wiley 2000.
Compiler Design Lexical Analysis Syntactical Analysis Semantic Analysis Optimization Code Generation.
CS 153: Concepts of Compiler Design August 25 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Abstract Syntax Mooly Sagiv html://
Compiler design Computer Science Rensselaer Polytechnic Lecture 1.
ANTLR.
CPSC 388 – Compiler Design and Construction Lecture: MWF 11:00am-12:20pm, Room 106 Colton.
Invitation to Computer Science 5th Edition
贺天行.  First please download to appetitzer in our webpage  This tutorial will be mainly about codes provided in the appetizer.
COP4020 Programming Languages
CS 153: Concepts of Compiler Design August 24 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
CSC 338: Compiler design and implementation
Compiler course 1. Introduction. Outline Scope of the course Disciplines involved in it Abstract view for a compiler Front-end and back-end tasks Modules.
CST320 - Lec 11 Why study compilers? n n Ties lots of things you know together: –Theory (finite automata, grammars) –Data structures –Modularization –Utilization.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
COMPILER OVERVIEW. Compiler Phases  Syntactic Analysis (Lexing, Parsing)  c = (a + b) * (a + b);
Parse & Syntax Trees Syntax & Semantic Errors Mini-Lecture.
Towards the better software metrics tool motivation and the first experiences Gordana Rakić Zoran Budimac.
1 Chapter 1 Introduction. 2 Outlines 1.1 Overview and History 1.2 What Do Compilers Do? 1.3 The Structure of a Compiler 1.4 The Syntax and Semantics of.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 1, 08/28/03 Prof. Roy Levow.
Abstract Syntax Trees Compiler Baojian Hua
Compiler design Lecture 1: Compiler Overview Sulaimany University 2 Oct
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Introduction Lecture 1 Wed, Jan 12, The Stages of Compilation Lexical analysis. Syntactic analysis. Semantic analysis. Intermediate code generation.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
. n COMPILERS n n AND n n INTERPRETERS. -Compilers nA compiler is a program thatt reads a program written in one language - the source language- and translates.
Introduction to Compiling
Introduction CPSC 388 Ellen Walker Hiram College.
Chapter 1 Introduction Major Data Structures in Compiler
Compiler Design Introduction 1. 2 Course Outline Introduction to Compiling Lexical Analysis Syntax Analysis –Context Free Grammars –Top-Down Parsing –Bottom-Up.
Compiler Introduction 1 Kavita Patel. Outlines 2  1.1 What Do Compilers Do?  1.2 The Structure of a Compiler  1.3 Compilation Process  1.4 Phases.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
The Model of Compilation Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
CSC 4181 Compiler Construction
LECTURE 3 Compiler Phases. COMPILER PHASES Compilation of a program proceeds through a fixed series of phases.  Each phase uses an (intermediate) form.
Presented by : A best website designer company. Chapter 1 Introduction Prof Chung. 1.
Prologue Sung-Dong Kim, Dept. of Computer Engineering, Hansung University.
Welcome! Simone Campanoni
CHAPTER 1 INTRODUCTION TO COMPILER SUNG-DONG KIM, DEPT. OF COMPUTER ENGINEERING, HANSUNG UNIVERSITY.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Advanced Computer Systems
Compiler Design (40-414) Main Text Book:
PRINCIPLES OF COMPILER DESIGN
Chapter 1 Introduction.
Introduction to Compiler Construction
Chapter 1 Introduction.
课程名 编译原理 Compiling Techniques
Chapter 1: Introduction to Compiling (Cont.)
Compiler Lecture 1 CS510.
CMPE 152: Compiler Design December 5 Class Meeting
An Overview to Compiler Design
Basic Program Analysis: AST
Lecture 2: General Structure of a Compiler
CSE401 Introduction to Compiler Construction
Subject: Language Processor
Tiger Compiler Project
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Chapter 1 Introduction.
Introduction to ANTLR Jin Tianxing
Presentation transcript:

Project: ACM Compiler 2014 Shanghai Jiao Tong University Class ACM 2011 Dong Xie

Introduction

 Task: Write a compiler of simplified C in full-featured Java to MIPS.  Main Reference Book: Compilers Principles Techniques and Tools  You may also need more materials:  Modern Compiler Implementation in Java/C/ML  MIPS-SPIM document  All kinds of papers  …

Introduction  You are allowed to use a language other than Java  Whoever bootstrapping C will get a full score  NO bonus needed for other language  BUT you may not have a good support from your TAs.  Apply it explicitly to TAs if you want to do this.

TA List  贺 天行 cloudygooseg [at] gmail.com  解 东 xiedong1993 [at] gmail.com  吴航 wuzhongminghang [at] gmail.com  金天行 [at] qq.com  Google Groups: tiger-acm-sjtu [at] googlegroups.com  IMPORTANT Be sure you have join this group.

Schedule & Principles  Lecture: every Friday 7 PM at SEIEE Building  Project Checkpoint Due: on some Friday 6 PM  There will be TWO code reviews during the project  NO CHEATING  NO LATE SUBMISSION  All test cases will be publicly available.

Versioning & Submission  Version your compiler codes using BitBucket.  You are NOT allowed to publish your code on the Internet  Create a private repo named compiler2014  Add username acmcompiler to your repository with read permission  Submit your code for each phase by creating a tag.

Grading  Data Correctness (60 points)  Performance (20 points)  Code review (5 points)  Attendance (5 points)  Bonus  Report  Mail list Summary  Helper  Book Reader  Performance Winners

Possible Bonus List  Use C language to implement the compiler.  Implement typedef  Implement higher order functions. (lambda expression, etc.)  Static analyzer (abstract interpreter)  Garbage collection (If you pass our testcases, you can get this bonus.)  Optimization (loop-unrolling, constants propagation, inline functions, dead code elimination, etc.)  Concurrency and scheduling  Reconstruct the AST ...

Q & A

Compiler Overview

Compilers vs. Interpreters  Compilers:  Interpreters:

Compiler Phases  Syntactic Analysis (Lexing, Parsing)  Semantic Analysis (Types, Scopes, …)  Intermediate Representation (IR)  Optimization (CPU, Registers, Memory, …)  Code Generation  Difference between compilers and interpreters?

Example  int a = 1;  print(a);  int b = “hello”  print(b)  When will a compiler and a interpreter raise the error.

Compiler Phases

Example  a = b + 42  ID(a) OP(=) ID(b) OP(+) NUM(42)

Example  t3 := t  t2 := t3  lw $t1, -8($fp)  addi $t2, $t1, 42  sw $t2, -4($fp)

An Appetizer  A toy compiler as a tutorial written by Xiao Jia  Notice: you may not find IR phase in it.  You will find it VERY IMPORTANT if you have no idea to start.  Description:  Source Code:

Q & A

Phase 1: Syntactic Analysis

Example: Input #include int main(int argc) { printf(“Hello World!\n”); return 0 }

Task 1: Tokenlize int ( int ) { ( ) ; return ; }

Task 2: Parsering (func int main[(arg int argc)]) (stmtlist (expr (call printf[“Hello World!\n”])) (stmtlist (return (number 0))))  Note: you need to print out a AST NOT a Parser Tree.

Syntactic Specification  Tokens:  Grammar:

Tools & Grading  Following tools are allowed:  lex / yacc / Quex / flex / bison  re2c / lemon  Jflex / CUP  ANTLR (v3 or v4)  Ragel  This phase will be manually judged in code review.  Feel free to design your own output formats!

Q & A

Thanks for listening… Contact: