CMPE 152: Compiler Design January 25 Class Meeting

Slides:



Advertisements
Similar presentations
Introduction to Compiler Construction
Advertisements

1 Programming Languages Translation  Lecture Objectives:  Be able to list and explain five features of the Java programming language.  Be able to explain.
CS 153: Concepts of Compiler Design August 25 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
CS 235: User Interface Design January 22 Class Meeting
CS 157B: Database Management Systems II February 27 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
CS 149: Operating Systems January 22 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
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.
CS 235: User Interface Design August 25 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Course Introduction Software Engineering
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Programming Concept Chapter I Introduction to Java Programming.
Programming Languages & Translators (CE 359) Fall 2013 Prof. Dr: Ahmed El Nahass Lecture 1 1 FACULTY OF ENGINEERING COMPUTER ENGINEERING Prof.Dr Ahmed.
Compiling and the Java Virtual Machine (JVM). The syntax of Pseudocode is pretty loose –visual validation encourages a permissive approach –emphasized.
CEN 4010 First Lecture January 9, 2006 CEN 4010 Introduction to Software Engineering Spring 2006 Instructor: Masoud Sadjadi
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
CS 153: Concepts of Compiler Design August 26 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Ministry of Higher Education Sohar College of Applied Sciences IT department Comp Introduction to Programming Using C++ Fall, 2011.
CS 152: Programming Language Paradigms January 27 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
CS 153: Concepts of Compiler Design October 21 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
CS 160 and CMPE/SE 131 Software Engineering January 28 Class Meeting
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
ICS312 Introduction to Compilers Set 23. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
COMP 3002: Compiler Construction Pat Morin School of Computer Science.
CS 432: Compiler Construction Lecture 1
CMPT 201 Computer Science II for Engineers
General information Course web page:
Lecture 1b- Introduction
Component 1.6.
Computer Engineering Department Islamic University of Gaza
CS101 Computer Programming I
CS 153: Concepts of Compiler Design August 24 Class Meeting
PRINCIPLES OF COMPILER DESIGN
Introduction to Compiler Construction
C Programming.
CS 153: Concepts of Compiler Design August 29 Class Meeting
C Programming Language
CS 153: Concepts of Compiler Design November 30 Class Meeting
CMPE 152: Compiler Design December 5 Class Meeting
CMPE 152: Compiler Design ANTLR 4 and C++
Introduction to Java Dept. Business Computing University of Winnipeg
Introduction to Compiler Construction
Compiler Construction
C Programming.
CMPE 152: Compiler Design August 21 Class Meeting
CMPE 152: Compiler Design September 11/13 Lab
CMPE 152: Compiler Design August 23 Class Meeting
CMPE 152: Compiler Design August 21/23 Lab
Computer Programming 1 introduction to JAVA Lecture 1 Instructor: Ruba A. Salamah Islamic University of Gaza.
CMPE 152: Compiler Design December 6 Class Meeting
Accelerated Introduction to Computer Science
CMPE 152: Compiler Design January 24 Class Meeting
Introduction to Compiler Construction
CMPE 152: Compiler Design January 29 Class Meeting
CMPE 152: Compiler Design February 21/26 Lab
Computer Engineering Department Islamic University of Gaza
CMPE 152: Compiler Design February 28 / March 5 Lab
CS 144 Advanced C++ Programming January 24 Class Meeting
CMPE 280 Web UI Design and Development May 9 Class Meeting
CMPE 152: Compiler Design April 18 – 30 Labs
Introduction to Compiler Construction
CMPE 152: Compiler Design March 19 Class Meeting
CMPE 152: Compiler Design March 7/12 Lab
ICS103 Programming in C 1: Overview of Computers And Programming
CMPE 152: Compiler Design May 2 Class Meeting
CMPE 152: Compiler Design August 22 Class Meeting
CMPE 152: Compiler Design August 27 Class Meeting
Presentation transcript:

CMPE 152: Compiler Design January 25 Class Meeting Department of Computer Engineering San Jose State University Spring 2018 Instructor: Ron Mak www.cs.sjsu.edu/~mak

Basic Info Office hours Website TuTh 3:00 – 4:00 PM ENG 250 Faculty webpage: http://www.cs.sjsu.edu/~mak/ Class webpage: http://www.cs.sjsu.edu/~mak/CMPE152/index.html Syllabus Assignments Lecture notes

Permission Numbers Go to the Computer Engineering Department website: https://cmpe.sjsu.edu Click the link in the sidebar: Spring 2018 Registration Notes Click the link under “Spring 2018 Online permission number request” Fill out the Google form.

Goals of the Course 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 (JVM). Successfully run your programs on the JVM.

Goals of the Course, cont’d 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 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.

Course Learning Outcomes, cont’d 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.

Course Learning Outcomes, cont’d 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.

Course Overview First half: Modify a Pascal interpreter. Midterm The interpreter is written in Java (the implementation language). The source programs are written in Pascal (the source language). The implementation code for the interpreter will be presented to you incrementally. Midterm

Course Overview, cont’d Second half: Your compiler project. ANTLR 4 compiler-compiler Java Virtual Machine (JVM) architecture Jasmin assembly language Back end code generator Final

Required Textbooks Writing Compilers and Interpreters, 3rd edition Author: Ronald Mak Publisher: Wiley ISBN: 978-0-470-17707-5 Source code: http://www.cs.sjsu.edu/~mak/CMPE152/sources/ (Java and C++) The Definitive ANTLR 4 Reference Author: Terence Parr Publisher: Pragmatic Bookshelf ISBN: 978-1934356999 URL: http://www.antlr.org Use during the entire semester. Use during the second half of the semester.

Project Teams Projects will be done by small project teams. Projects will be broken up into assignments. Form your own teams of 4 members each. Choose your team members wisely! Be sure you’ll be able to meet and communicate with each other and work together well. No moving from team to team. Each team member will receive the same score on each team assignment and team project.

Project Teams, cont’d Each team email to ron.mak@sjsu.edu by Wednesday, January 31: Your team name A list of team members and email addresses Subject: CMPE 152 Team Team Name Example: CMPE 152 Team Hyper Hackers

Individual Responsibilities You are personally responsible for participating and contributing to your team’s work, and for understanding each part of the work for every assignment whether or not you worked on that part.

Postmortem Assessment Report At the end of the semester, each student will individually turn in a short (one page) report: A brief description of what you learned in the course. An assessment of your personal accomplishments for your project team. An assessment of the contributions of each of your project team members. This report will be seen only by the instructor.

Your Individual Overall Class Grade Your final class grade will be adjusted up or down depending on your level and quality of participation, as reported by your teammates’ postmortem reports. 30% assignments 35% project 15% midterm 20% final During the semester, keep track of your progress in Canvas. At the end of the semester, students with the median score will get the B grade. Higher and lower grades will then be assigned based on how the scores cluster above and below the median. Therefore, your final class grade will be based primarily on your performance relative to the other students in the class.

Participation is Important Can move your final grade up or down, especially in borderline cases. Participation in class. Participation in your team. As reported by the postmortem assessment reports.

Take roll!

Compiler Magic? C compiler: Pascal compiler: Java compiler: int main() { printf("Hello, C world!\n"); } Pascal compiler: PROGRAM hello; BEGIN writeln('Hello, Pascal world!'); END. Java compiler: public class Hello { public static void main(String args[]) System.out.println("Hello, Java world!"); }

Overview of the Compilation Process What’s in this box? hello.pas hello.cpp Pascal compiler (you will write this in C++) C++ compiler Translation: g++ -c hello.cpp hello.j hello.o assembly language object program Jasmin assembler (provided for you) Translation: hello.class binary object program Java linker & loader (provided for you) C++ linker & loader g++ -o hello hello.o Java Virtual Machine (provided for you) hello Directly on your laptop or workstation. Execution: ./hello

What is a Compiler? A software utility that is extremely important for developing applications … … usually overlooked and taken for granted ... UNLESS you can’t get your program to compile!

A Compiler is a Translator A compiler translates a program that you’ve written ... in a high-level language C, C++, Java, Pascal, etc. ... into a low-level language assembly language or machine language ... that a computer can understand and eventually execute.

Assignment #1 Posted to the class web page: http://www.cs.sjsu.edu/~mak/CMPE152/index.html Write a simple Pascal program. An individual (not team) assignment. You may work together to learn the language. But what you turn in must be your own work. Due Friday, February 2.

Assignment #1, cont’d Download and install the Lazarus/Free Pascal IDE for Pascal: https://www.lazarus-ide.org Online Pascal tutorials: https://www.tutorialspoint.com/pascal/ http://www.taoyue.com/tutorials/pascal/

Assignment #1, cont’d Sample Pascal program: http://www.cs.sjsu.edu/~mak/CMPE152/assignments/1/EmployeeListing.pas Input file: http://www.cs.sjsu.edu/~mak/CMPE152/assignments/1/employees.txt Output file: http://www.cs.sjsu.edu/~mak/CMPE152/assignments/1/output.txt LAST