CMPE 152: Compiler Design August 22 Class Meeting

Slides:



Advertisements
Similar presentations
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
Advertisements

OBJECT ORIENTED PROGRAMMING I LECTURE 1 GEORGE KOUTSOGIANNAKIS
CSC 171 – FALL 2004 COMPUTER PROGRAMMING LECTURE 0 ADMINISTRATION.
CS 153: Concepts of Compiler Design August 25 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Computer Science - I Course Introduction Computer Science Department Boston College Hao Jiang.
CS 235: User Interface Design January 22 Class Meeting
CS 160: Software Engineering August 27 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Introduction COMP104: Fundamentals and Methodology.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
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
Course Overview Ted Baker  Andy Wang COP 5641 / CIS 4930.
Programming Concept Chapter I Introduction to Java Programming.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
MSE 101 ON LINE LECTURE INTRODUCTION LECTURE & LABORATORY Professor: Professor Shahriar Manufacturing Systems & Engineering Management Dept.  Faculty.
CS 153: Concepts of Compiler Design August 26 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Introduction Fall 2001 Foundations of Computer Systems Prerequisite:91.166* or * Section A Instructor: Dr. David Hutchinson Office:
CS 152: Programming Language Paradigms January 27 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
Compiler Construction (CS-636)
Lecture 2 Programming life cycle. computer piano analogy Piano + player - computer hardware Musical score/notes - software or program Composer - programmer.
1 Introduction to C Programming 計算機程式設計 2/22/2012 朱浩華.
Course Overview Ted Baker  Andy Wang COP 5641 / CIS 4930.
COT 4600 Operating Systems Fall 2010 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:30-4:30 PM.
Welcome to Physics 2215! Physics Lab for Scientist & Engineers 1 Spring 2013.
CS 432: Compiler Construction Lecture 1
Lecture 1b- Introduction
Course Overview - Database Systems
Computer Engineering Department Islamic University of Gaza
CS101 Computer Programming I
CSc 1302 Principles of Computer Science II
CS 153: Concepts of Compiler Design August 24 Class Meeting
CS 153: Concepts of Compiler Design August 29 Class Meeting
Welcome to Physics 2015! (General Physics Lab 1 – Spring 2013)
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 January 25 Class Meeting
Programming COMP104: Fundamentals and Methodology Introduction.
Welcome to CS 1010! Algorithmic Problem Solving.
Programming Languages
Computer Networks CNT5106C
Course Overview - Database Systems
Compiler Construction
Welcome to CS 1010! Algorithmic Problem Solving.
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 December 6 Class Meeting
Accelerated Introduction to Computer Science
CMPE 152: Compiler Design January 24 Class Meeting
Your Course Course code : MKT2231
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
Introduction Andrew Whitaker
EECE.4810/EECE.5730 Operating Systems
CMPE 152: Compiler Design April 18 – 30 Labs
Computer Engineering Department Islamic University of Gaza
CMPE 152: Compiler Design March 7/12 Lab
CSC 241: Introduction to Computer Science I
Welcome to Physics 2025! (General Physics Lab 2 - Fall 2012)
CMPE 152: Compiler Design August 27 Class Meeting
Presentation transcript:

CMPE 152: Compiler Design August 22 Class Meeting Department of Computer Engineering San Jose State University Fall 2019 Instructor: Ron Mak www.cs.sjsu.edu/~mak

Basic Info Office hours Website TuTh 4:30 – 5:30 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: Fall 2019 Registration Notes Click the link under “Fall 2019 Online permission number request” Fill out the Google form.

Goals of the Course 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. Compile your programs into executable machine code that you can run.

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. This is a challenging course that will demand much of your time and effort throughout the semester.

Course Learning Objectives Use and control the structure and operation of compilers. Evaluate the relation of a high-level language to its assembler and microprocessor underpinnings. Apply the theory and application of finite state machines, recursive descent, production rules, parsing, and language semantics.

Course Timeline First half: Modify a Pascal interpreter. Midterm The interpreter is written in C++ (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 Timeline, 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 (Java and C++) : http://www.cs.sjsu.edu/~mak/CMPE152/sources/index.html 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. Team assignments will help complete the projects. 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, August 28: 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 30% assignments* 35% project* 15% midterm** 20% final** * team score ** individual score 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. 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.

Class Format Each class will start with a short lecture. Highlights of the reading assignment. It’s important to do the chapter readings before coming to class! Lab time after the lecture. Teams work on lab assignments.

Please Submit to Canvas A signed copy of the Honesty Pledge. A copy of your transcript with the prerequisite courses highlighted: CMPE 102 Assembly language programming CMPE 126 Algorithms and data structure design These are required by the Computer Engineering Department. I’m obligated to drop any student who cannot show the prerequisite courses on his or her transcript.

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.

More Definitions source program: the program (application) that you write in a high-level language which the compiler will translate Usually stored in a source file (text). source language: the high-level language in which you write your source program Examples: Pascal, Java, C++

More Definitions, cont’d object language: the low-level language (AKA target language) into which the compiler translates the source program Do not confuse object language with object-oriented language. Example: Jasmin assembly language Example: Intel machine code object program: your program after it has been translated into the object language

More Definitions, cont’d target machine: the computer that will eventually execute the object program Example: Your laptop’s hardware Example: The Java Virtual Machine (JVM) The JVM runs on your workstation or laptop (any computer that supports Java) implementation language: the language that the compiler itself is written in Example: Java, C++

What Else Can Compilers Do? Compilers allow you to program in a high-level language and think about your algorithms, not about machine architecture. Compilers provide language portability. You can run your C++ and Java programs on different machines because their compilers enforce language standards.

What Else Can Compilers Do? cont’d Compilers can optimize and improve the execution of your programs. Optimize the object code for speed. Optimize the object code for size. Optimize the object code for power consumption.

Learn Pascal! To prepare for next week’s lab assignment, read one of the Pascal tutorials. Pascal Tutorial http://www.tutorialspoint.com/pascal/ Learn Pascal http://www.taoyue.com/tutorials/pascal/ It was the teaching language of the 1980s. Much easier to learn than to C++. It’s an easy language to compile. It will be our sample source language.

Sample Pascal Program Program: http://www.cs.sjsu.edu/~mak/CMPE152/assignments/1/EmployeeListing.pas Input file: http://www.cs.sjsu.edu/~mak/CMPE152assignments/1/employees.txt Output: http://www.cs.sjsu.edu/~mak/CMPE152/assignments/1/output.txt Online Pascal development sites: http://rextester.com/l/pascal_online_compiler https://www.tutorialspoint.com/compile_pascal_online.php https://www.jdoodle.com/execute-pascal-online

Reminder: By Wednesday, August 28 Form teams. Email me your team information. team name team members and email addresses