CMPE 152 Compiler Design

Similar documents
CS/SE 153 Concepts of Compiler Design

CMPE 152 Compiler Design

CMPE 152 Compiler Design

CS/SE 153 Concepts of Compiler Design

CMPE 280 Web UI Design and Development

CMPE/SE 135 Object-Oriented Analysis and Design

CMPE 280 Web UI Design and Development

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 3 & 4, Fall Semester, 2016

CMPE 180A Data Structures and Algorithms in C++

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 CS049J, Programming in Java, Section 2, Fall, 2016

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

ECE573 Introduction to Compilers & Translators

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

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

Compilers. Computer Science 431

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

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

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

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, Section 04 Object Oriented Design Spring 2018

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

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

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

AE Computer Programming for Aerospace Engineers

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

CS 3270 Mobile Development for Android Syllabus

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

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

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

Compilers for Modern Architectures Course Syllabus, Spring 2015

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

CASPER COLLEGE COURSE SYLLABUS MSFT 1600 Managing Microsoft Exchange Server 2003 Semester/Year: Fall 2007

San Jose State University - Department of Computer Science

Translator Design CRN Course Administration CMSC 4173 Spring 2017

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

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

INF 315E Introduction to Databases School of Information Fall 2015

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

Course and Contact Information. Course Description. Course Objectives

CS 241 Data Organization using C

ECE Introduction to Compilers and Translation Engineering

Course and Contact Information. Course Description. Course Objectives

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

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

CS157a Fall 2018 Sec3 Home Page/Syllabus

Translator Design CRN Course Administration CMSC 4173 Spring 2018

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

Computer Science Technology Department

General Course Information. Catalogue Description. Objectives

Principles of Compiler Construction ( )

CSC 111 Introduction to Computer Science (Section C)

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

CS 4230 Java Application Development Syllabus

CS 4230 Java Application Development Syllabus

ESET 349 Microcontroller Architecture, Fall 2018

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

Network Fundamentals and Design Fall Semester 2014

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

A: 90% - 100% B: 80% - <90% C: 70% - <80% D: 60% - <70% F: < 60% Important Dates:

CS 3030 Scripting Languages Syllabus

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

CSCI 565 Compiler Design and Implementation Spring 2014

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

ISM 324: Information Systems Security Spring 2014

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

Compiling Techniques

Syllabus Revised 08/21/17

Fundamentals of Computer Science CSCI 136 Syllabus Fall 2018

CSc 2310 Principles of Programming (Java) Jyoti Islam

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

Evaluation Scheme L T P Total Credit Theory Mid Sem Exam

CoSci 487 SYLLABUS Introduction to Networks

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

CS 3304 Comparative Languages. Lecture 1: Introduction

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

Instructor: Anna Miller

Principles of Compiler Construction ( )

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

ab Houston Community College

KOMAR UNIVERSITY OF SCIENCE AND TECHNOLOGY (KUST)

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

Web Programming Fall 2011

GUJARAT TECHNOLOGICAL UNIVERSITY

ITT Technical Institute. SD2720 Advanced Software Development Using Java Onsite and Online Course SYLLABUS

CMPE012 Computer Engineering 12 (and Lab) Computing Systems and Assembly Language Programming. Summer 2009

CPS352 Database Systems Syllabus Fall 2012

COLLEGE OF DUPAGE CIS 2542 Advanced C++ with Data Structure Applications Course Syllabus

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

Course Syllabus. NTM 2415 Cisco TCP/IP Routing Protocols & Router Configuration Cisco Networking Academy Cisco Semesters 1 & 2 Online Spring 2015

CS 241 Data Organization. August 21, 2018

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

Developing Web Applications and Services Course Syllabus Fall 2015

Murach's HTML and CSS3 3 rd Edition By Boehm, Anne Fresno, Calif Publisher: Mike Murach & Associates, 2015 ISBN-13:

Tutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment

Introduction to Programming System Design CSCI 455x (4 Units)

The University of Jordan

CSCI 201L Syllabus Principles of Software Development Spring 2018

Spring 2018 El Camino College E. Ambrosio. Course Syllabus

Transcription:

San José State University Department of Computer Engineering CMPE 152 Compiler Design Section 1 (Class) Sections 2 and 3 (s) Fall 2018 Course and Contact Information Instructor: Ron Mak Office Location: ENG 250 Email: ron.mak@sjsu.edu Website: http://www.cs.sjsu.edu/~mak/ Office Hours: TuTh 3:00-4:00 PM Class Days/Time: TuTh 4:30-5:20 PM s Days/Time: Section 2: Tu 6:00 8:45 PM Section 3: Th 6:00 8:45 PM Classrooms: Class: ENG 343 s: ENG 206 Prerequisites: CMPE 126, CMPE 102 (both with grade of "C-" or better). Course Format This course will be taught primarily via classroom presentations. Faculty Web Page and Canvas Course materials, syllabus, assignments, grading criteria, exams, and other information will be posted at my faculty website at http://www.cs.sjsu.edu/~mak and on the Canvas Learning Management System course login website at http://sjsu.instructure.com. You are responsible for regularly checking these websites to learn of any updates. You can find Canvas video tutorials and documentations at http://ges.sjsu.edu/canvas-students 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. CMPE 152 Compiler Design, Fall 2018, Ron Mak Page 1 of 8

Course Goals This course will concentrate on practical aspects of compiler construction, programming language design, and engineering a large, complex software application. Compiler construction and language design. Design and build a working compiler for a programming language that you invented. Write sample programs in your language and then compile them into executable machine code that you can run. 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, students will be able to: CLO 1: Develop a scanner and a parser for a programming language. CLO 2: Perform syntactic and semantic analyses of source programs. CLO 3: Generate symbol tables and intermediate code for source programs. CLO 4: Develop an interpreter that executes a source program in a suitable runtime environment. CLO 5: Design the grammar for a programming language and feed it into a compiler-compiler. CLO 6: Develop a compiler that translates a source program into executable machine code. CLO 7: Engineer a large, complex software application. Required texts Title: Writing Compilers and Interpreters, 3 rd edition Author: Ronald Mak Publisher: Wiley Publishers, Inc. ISBN: 978-0-470-17707-5 Source files: http://www.cs.sjsu.edu/~mak/cmpe152/sources Title: Author: Publisher: ISBN: (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. 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. Some online websites to compile and run Pascal programs: http://rextester.com/l/pascal_online_compiler https://www.tutorialspoint.com/compile_pascal_online.php https://www.jdoodle.com/execute-pascal-online CMPE 152 Compiler Design, Fall 2018, Ron Mak Page 2 of 8

Course Requirements and Assignments You must have good C++ programming skills and be familiar with 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 assignments 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. 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 Program s Syllabus Information web page at http://www.sjsu.edu/gup/syllabusinfo/ 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. CMPE 152 Compiler Design, Fall 2018, Ron Mak Page 3 of 8

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: Invent a new programming language or choose a subset of an existing language. Develop 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). 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 The midterm and final examinations will be closed book. 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. The exams will test understanding (not memorization) of the material taught during the semester and now well each of you participated in your team assignments and project. CMPE 152 Compiler Design, Fall 2018, Ron Mak Page 4 of 8

Grading Information Individual total scores will be computed with these weights: 30% Assignments* 35% Compiler project* 15% Midterm exam** 20% Final exam** * team scores ** individual scores Course grades will be based on a curve. Per CMPE Department policy, the median total score will earn a B. Approximately one third of the class will earn higher grades, and another one third will earn lower grades. Postmortem report At the end of the semester, each student must also turn in a short (under 1 page) individual postmortem report that includes: A brief description of what you learned in the course. An assessment of your accomplishments for your team assignments and design project. An assessment of each of your other project team members. Only the instructor will see these reports. How your teammates evaluate you may affect your course grade. Classroom Protocol It is very important for each student to attend classes and to participate. Mobile devices 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 Program s Syllabus Information web page at http://www.sjsu.edu/gup/syllabusinfo/. CMPE 152 Compiler Design, Fall 2018, Ron Mak Page 5 of 8

CMPE 152 Compiler Design Section 1 (Class) Sections 2 and 3 (s) Fall 2018 Course Schedule (subject to change with fair notice) WCI = Writing Compilers and Interpreters, 3rd edition ANTLR = The Definitive ANTLR 4 Reference, 2 nd edition Week Date Topics Readings 1 Aug 21 Aug 23 2 Aug 28 Aug 30 3 Sept 4 Sept 6 4 Sept 11 Sept 13 5 Sept 18 Sept 20 6 Sept 25 Sept 27 Overview of the course What are compilers and interpreters? A software framework for compilers and interpreters Syntax diagrams Form programming teams Install software Scanning (lexical analysis) Symbol table management Top-down recursive-descent parsing 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 CMPE 152 Compiler Design, Fall 2018, Ron Mak Page 6 of 8

Week Date Topics Readings 7 Oct 2 Oct 4 8 Oct 9 Oct 11 9 Oct 16 Oct 18 10 Oct 23 Oct 25 11 Oct 30 Nov 1 12 Nov 6 Nov 8 13 Nov 13 Nov 15 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, October 11 (75 min.) Interpret Pascal programs A simple DFA scanner BNF grammars for programming languages The ANTLR compiler-compiler Create an ANTLR grammar 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 14 Nov 20 Code for control statements Code for arrays Code for records 15 Nov 27 Nov 29 16 Dec 4 Dec 6 Execute compiled Pascal programs Bottom-up parsing Lex and Yacc Code optimization Generate code for control statements Generate code for arrays and records Team compiler demos (optional) Course review Generate code for complete Pascal programs WCI 15 ANTLR 7, 8 WCI 16 ANTLR 9 WCI 17 WCI 18 CMPE 152 Compiler Design, Fall 2018, Ron Mak Page 7 of 8

Week Date Topics Readings Final Exam Friday Dec. 14 Time: 2:45-5:00 PM Room: ENG 343 CMPE 152 Compiler Design, Fall 2018, Ron Mak Page 8 of 8