CMPE 152 Compiler Design

Similar documents
CMPE 152 Compiler Design

CMPE 152 Compiler Design

CS/SE 153 Concepts of Compiler Design

CS/SE 153 Concepts of Compiler Design

CMPE/SE 135 Object-Oriented Analysis and Design

CMPE 280 Web UI Design and Development

CMPE 280 Web UI Design and Development

CMPE 180A Data Structures and Algorithms in C++

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

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

San José State University Department of Computer Science CS166, Information Security, Section 1, Fall, 2018

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

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

San José State University Department of Computer Science CS151, Object Oriented Design, Section 04, Fall, 2016 (42968)

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

San José State University Department of Computer Science CS049J, Programming in Java, Section 2, Fall, 2016

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

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

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

Compilers. Computer Science 431

San José State University Department of Computer Science CS 166 / SE 166, Information Security, Section 4, spring, 2017

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

San José State University Computer Science CS 122 Advanced Python Programming Spring 2018

San Jose State University - Department of Computer Science

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

ECE573 Introduction to Compilers & Translators

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

AE Computer Programming for Aerospace Engineers

B. Subject-specific skills B1. Problem solving skills: Supply the student with the ability to solve different problems related to the topics

San José State University Computer Science Department CS157A: Introduction to Database Management Systems Sections 5 and 6, Fall 2015

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

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

KOMAR UNIVERSITY OF SCIENCE AND TECHNOLOGY (KUST)

Compilers for Modern Architectures Course Syllabus, Spring 2015

INST Database Design and Modeling - Section 0101 Spring Tentative Syllabus

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

CS 241 Data Organization using C

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

CNG 140 C Programming. Syllabus. Course Info Fall Semester. Catalog Description

ECE Introduction to Compilers and Translation Engineering

Translator Design CRN Course Administration CMSC 4173 Spring 2017

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

General Course Information. Catalogue Description. Objectives

San Jose State University College of Science Department of Computer Science CS185C, Introduction to NoSQL databases, Spring 2017

THE UNIVERSITY OF TEXAS AT AUSTIN MIS373 e-discovery and Digital Forensics SPRING 2015 Unique#: (03665) VERSION: 2_011718

CS 3270 Mobile Development for Android Syllabus

CSE 504: Compiler Design

Syllabus Revised 01/03/2018

CS120 Computer Science I. Instructor: Jia Song

Computer Science Technology Department

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

ISM 324: Information Systems Security Spring 2014

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

San José State University College of Science / Department of Computer Science Introduction to Database Management Systems, CS157A-3-4, Fall 2017

CMPE 180A Data Structures and Algorithms in C++ Spring 2018

Cleveland State University

University of Maryland at College Park Department of Geographical Sciences GEOG 477/ GEOG777: Mobile GIS Development

CMSC 132: Object-Oriented Programming II. Administrivia

INF 315E Introduction to Databases School of Information Fall 2015

Rochester Institute of Technology Golisano College of Computing and Information Sciences Department of Information Sciences and Technologies

HOUSTON COMMUNITY COLLEGE BUSINESS TECHNOLOGY NORTHEAST COLLEGE-NORTHLINE LOCATION COURSE SYLLABUS FALL 2011 COMPUTER APPLICATION I POFI 1301

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

BRAZOSPORT COLLEGE LAKE JACKSON, TEXAS SYLLABUS COSC 1320: INTRODUCTION TO C++ PROGRAMMING COMPUTER TECHNOLOGY & OFFICE ADMINISTRATION DEPARTMENT

Course and Contact Information. Course Description. Course Objectives

Translator Design CRN Course Administration CMSC 4173 Spring 2018

San Jose State University College of Science Department of Computer Science CS185C, NoSQL Database Systems, Section 1, Spring 2018

CSc 2310 Principles of Programming (Java) Jyoti Islam

Course and Contact Information. Course Description. Course Objectives

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

San José State University Department of Computer Science CS158B, Computer Network Management, Section 1, Fall 2016

CSCI 565 Compiler Design and Implementation Spring 2014

Geography 3300: Transportation Security

Compiling Techniques

New York City College of Technology/CUNY Department of Computer Systems Technology. CST2400 Computer System Management and Support 4 hours 3 credits

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

ab Houston Community College

CS 241 Data Organization. August 21, 2018

Principles of Compiler Construction ( )

COURSE SYLLABUS AND INSTRUCTOR PLAN

Spring 2018 El Camino College E. Ambrosio. Course Syllabus

3D Graphics Programming Mira Costa High School - Class Syllabus,

CS 415 Midterm Exam Spring SOLUTION

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

Computer Science Technology Department

IT 341 Fall 2017 Syllabus. Department of Information Sciences and Technology Volgenau School of Engineering George Mason University

Syllabus -- CIS Computer Maintenance / A+ Certification

Computer Science Technology Department

CoSci 440 SYLLABUS Programming in C++ INSTRUCTOR Mari Rettke cell SECTION : and 13345

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

Evaluation Scheme L T P Total Credit Theory Mid Sem Exam

Advanced Topics in Database Systems Spring 2016

Course Syllabus Internal Control And Auditing ACNT 2331

CS 3304 Comparative Languages. Lecture 1: Introduction

CSCI 201L Syllabus Principles of Software Development Spring 2018

COURSE SYLLABUS FOR. COMP-297 Web Page Design: Adobe Dreamweaver

CS 3230 Object Oriented UI Development With Java Syllabus

CS 415 Midterm Exam Spring 2002

Computer Science Technology Department

Principles of Compiler Construction ( )

THE UNIVERSITY OF TEXAS AT AUSTIN MIS373 e-discovery and Digital Forensics SPRING 2015 Unique#: (03883) VERSION: 1/23/2015

Transcription:

San José State University Department of Computer Engineering CMPE 152 Compiler Design Course and contact information Instructor: Ron Mak Office Location: ENG 250 Email: Website: Office Hours: Section 4 (class) and Section 5 (lab) Spring 2018 ron.mak@sjsu.edu http://www.cs.sjsu.edu/~mak/ TuTh 3:00-4:00 PM Class Days/Time: Class: TuTh 4:30-5:20 PM Lab: Tu 6:00-8:45 PM Classroom: Class: ENG 325 Lab: ENG 206 Prerequisites: CMPE 126, CMPE 102 (both with grade of "C-" or better). Course format This course will be taught primarily face-to-face instruction. Course materials, syllabus, assignments, grading criteria, exams, and other information will be posted on the SJSU Canvas course site at http://sjsu.instructure.com/ You are responsible to check Canvas regularly for class work and exams. You also can find Canvas video tutorials and documentations at http://ges.sjsu.edu/canvas-students Faculty web page and MySJSU messaging Course materials such as syllabus, handouts, notes, assignment instructions, etc. can be found on my faculty web page at http://www.sjsu.edu/people/firstname.lastname and/or on Canvas Learning Management System course login website at http://sjsu.instructure.com. You are responsible for regularly checking with the messaging system through MySJSU at http://my.sjsu.edu to learn of any updates. Course website Course materials such as syllabus, handouts, notes, assignment instructions, etc. can be found on the class web page at http://www.cs.sjsu.edu/~mak/cmpe152/. Page 1 of 9

Course catalog description Principles of lexical analysis, finite state automata and parsing; issues of variable declarations, variable types, control statements, function calls, nested scopes and efficient assembler target code. Instructor s description This course will concentrate on practical aspects of programming language design and compiler construction. Language design and compiler construction. Design and build a working compiler for a programming language that you invented. Write sample programs in your language, compile your programs into byte code for the Java Virtual Machine, and then successfully run your programs on the JVM. Software engineering. Employ the best practices of object-oriented design and team-based software engineering. A compiler is a large, complex program! Managing the development of such a program requires learning critical job skills that are highly desired by employers. Course learning outcomes (CLO) Upon successful completion of this course, you will be able to: CLO 1: Develop a scanner and a parser for a procedure-oriented programming language. CLO 2: Generate a symbol table and intermediate code. CLO 3: Perform semantic analysis such as type checking. CLO 4: Develop an interpreter that creates a suitable runtime environment from the intermediate code and the symbol table and executes the source program. CLO 5: Use a compiler-compiler to generate a parser and a scanner based on a written grammar for an existing programming language or an invented language. CLO 6: Develop a compiler that generates assembly language object code that can be assembled into executable code for a real or a virtual machine. CLO 7: Manage a large, complex body of legacy code. You will develop the critical job skill of working in a small project team. Page 2 of 9

Required texts Title: Author: Publisher: ISBN: Source files: Title: Author: Publisher: ISBN: Writing Compilers and Interpreters, 3 rd edition Ronald Mak Wiley Publishers, Inc. 978-0-470-17707-5 http://www.cs.sjsu.edu/~mak/cmpe152/sources (both Java and C++ source files are available) The Definitive ANTLR 4 Reference, 2 nd edition Terence Parr Pragmatic Bookshelf 978-1934356999 http://www.antlr.org We will use the ANTLR 4 compiler-compiler during the second half of the course, so you won t need the ANTLR text until then. ANTLR 4 can generate compiler components written in either Java or C++. We will use Pascal as an example source language during semester. These online Pascal tutorials are helpful: Pascal Tutorial looks very good. It even has an online compiler. Learn Pascal also looks good, although it doesn't appear to cover set types. Course requirements and assignments You must have good C++ programming skills and know how to use software development tools such as Eclipse CDT. You will form project teams of four students each. Team membership is mandatory for this class. The teams will last throughout the semester. Once the teams are formed, you will not be allowed to move from one team to another, so form your teams wisely! Weekly team assignments during the first part of the semester will provide practice with compiler design techniques and give students experience adding new features to a large legacy code base. Each student on a team will receive the same score for each team assignment. Each team will submit its assignments into Canvas, where the rubric for scoring each will be displayed. Each assignment and project will be worth up to 100 points. Late projects will lose 20 points and an additional 20 points for each 24 hours after the due date. This is a challenging course that will demand much of your time and effort throughout the semester. Page 3 of 9

The university s syllabus policies: University Syllabus Policy S16-9 at http://www.sjsu.edu/senate/docs/s16-9.pdf. Office of Graduate and Undergraduate Programs Syllabus Information web page at http://www.sjsu.edu/gup/syllabusinfo/ The university s credit hour requirement: Success in this course is based on the expectation that students will spend, for each unit of credit, a minimum of 45 hours over the length of the course (normally 3 hours per unit per week with 1 of the hours used for lecture) for instruction or preparation/studying or course related activities including but not limited to internships, labs, clinical practica. Other course structures will have equivalent workload expectations as described in the syllabus. Team compiler project In addition to the team assignments, each student team will work on a compiler project throughout the semester. Each team will develop a working compiler for a newly invented language or for an existing language. Teams will be able to write, compile, and execute programs written in their invented or chosen languages. Each student on a team will receive the same score for the team project. Each project involves: Inventing a new programming language or choosing an existing language (or subset of the language). Developing a grammar for the language. Generating a compiler for the language using the ANTLR compiler-compiler. Other components may be borrowed from the compiler code given in the class. A minimally acceptable compiler project has at least these features: Two data types with type checking. Basic arithmetic operations with operator precedence. Assignment statements. A conditional control statement (e.g., IF). A looping control statement. Procedures or functions with calls and returns. Parameters passed by value or by reference. Basic error recovery (skip to semicolon or end of line). Nontrivial sample programs written in the source language. Generate Jasmin assembly code that can be successfully assembled. Execute the resulting.class file. No crashes (e.g., null pointer exceptions). Page 4 of 9

Each team will write a report (5-10 pp.) that includes: A high-level description of the design of the compiler with UML diagrams of the major classes. The grammar for your source language, either as syntax diagrams or in BNF. Code templates that show the Jasmin code your compiler generates for some key constructs of the source language. Exams Besides a final project from each team, there will be a written closed-book in-class midterm and final examination for each student. The exam will test understanding (not memorization) of the material taught during the semester and now well each you participated in your project team. Instant messaging, e-mails, texting, tweeting, file sharing, or any other forms of communication with anyone else during the exams will be strictly forbidden. There can be no make-up midterm examination unless there is a documented medical emergency. Make-up final examinations are available only under conditions dictated by University regulations. Postmortem report At the end of the semester, each student must also submit into Canvas in a short (1- or 2- page) individual postmortem report that includes: A brief description of what you learned in the course. An assessment of your accomplishments for your project team on the assignments and the compiler project. An assessment of each of your other project team members. Only the instructor will see these reports. How your teammates evaluate you will affect your class grade. Page 5 of 9

Class grade Your individual final class grade will be weighted as follows: 30% Assignments* 35% Compiler project* 15% Midterm exam** 20% Final exam** * project team scores ** individual scores During the semester, you can keep track of your individual progress in Canvas. Each assignment, project, and exam will be scored (given points) but not assigned a letter grade. The average score can be seen in Canvas after each assignment and exam. At the end of the semester, all the students will be ranked in the order of their weighted class scores. Students with scores near the median score will be assigned the B grade. Higher and lower grades, respectively, will then be assigned above and below the median. All students have the right, within a reasonable time, to know their academic scores, to review their grade-dependent work, and to be provided with explanations for the determination of their course grades. See University Policy F13-1 at http://www.sjsu.edu/senate/docs/f13-1.pdf for more details. Classroom protocol It is very important for each student to attend classes and to participate. Cell phones in silent mode, please. University policies Per University Policy S16-9, university-wide policy information relevant to all courses, such as academic integrity, accommodations, etc. will be available on Office of Graduate and Undergraduate Programs Syllabus Information web page at http://www.sjsu.edu/gup/syllabusinfo/. Page 6 of 9

CMPE 152 Compiler Design Section 4 (class) and Section 5 (lab) Spring 2018 This schedule is subject to change with fair notice which will be communicated through emails and announcements via Canvas and Piazza. Course schedule Subject to change with fair notice. WCI = Writing Compilers and Interpreters, 3 rd edition ANTLR = The Definitive ANTLR 4 Reference, 2 nd edition Week Date Topics Readings 1 Jan 25 Overview of the course What are compilers and interpreters? A software framework for compilers and interpreters Form programming teams 2 Jan 30 Feb 1 Jan 30 lab 3 Feb 6 Feb 8 Feb 6 lab 4 Feb 13 Feb 15 Feb 13 lab 5 Feb 20 Feb 22 Feb 20 lab 6 Feb 27 Mar 1 Feb 27 lab Syntax diagrams Scanning (lexical analysis) Symbol table management Top-down recursive-descent parsing Install software Write, compile, and run a Pascal program Parse assignment statements and expressions Intermediate code (parse trees) Create a scanner and a symbol table Interpret assignment statements and expressions Parsing control statements Parser error handling Add new control statements Interpret control statements Runtime error handling Parsing declarations Execute new control statements Parse declarations, cont'd Semantic actions and type checking Add new data types WCI 1, 2, 3 WCI 4 WCI 5 WCI 5 WCI 6, 7 WCI 8, 9 WCI 9, 10 Page 7 of 9

Week Date Topics Readings 7 Mar 6 Mar 8 Mar 6 lab 8 Mar 13 Mar 15 Mar 13 lab 9 Mar 20 Mar 22 Mar 20 lab Mar 26-30 10 Apr 3 Apr 5 Apr 3 lab 11 Apr 10 Apr 12 Apr 10 lab 12 Apr 17 Apr 19 Apr 17 lab 13 Apr 24 Apr 26 Apr 24 lab 14 May 1 May 3 May 1 lab 15 May 8 May 10 May 8 lab Scope and the symbol table stack Parse programs, procedures, and functions Parse procedure and function calls Runtime memory management The runtime stack and activation frames Implement runtime memory management Pass parameters by value and by reference Midcourse review Midterm exam Thursday, March 15 (75 min.) Interpret Pascal programs A simple DFA scanner BNF grammars for programming languages The ANTLR compiler-compiler Create an ANTLR grammar Spring break WCI 11, 12 WCI 12 ANTLR 1-4 Generate a scanner and a parser with ANTLR ANTLR 5, 6 Generate a scanner and parser for your programming language. The Java Virtual Machine (JVM) architecture Jasmin assembly language Code templates and code generation Design code templates Code for expressions Code for assignment statements Generate code for assignment statements and expressions Code for procedure and function calls Code to pass parameters by value and by reference Code for string operations Generate code for procedures and functions Code for control statements Code for arrays Code for records Generate code for control statements Generate code for arrays and records Execute compiled Pascal programs Bottom-up parsing Lex and Yacc Code optimization Generate code for complete Pascal programs WCI 15 ANTLR 7, 8 WCI 16 ANTLR 9 WCI 17 WCI 18 Page 8 of 9

Week Date Topics Readings Final Exam Thursday May 17 Time: 2:45-5:00 PM Room: ENG 325 Page 9 of 9