Using Real Compiler Source Code for Teaching Graduate Compiler Design

Slides:



Advertisements
Similar presentations
Compilers Course 379K, TTH 9:30-11:00 Instructor: Dr. Doron A. Peled Office Hours: Mon 11:00-12:00.
Advertisements

Software & Services Group, Developer Products Division Copyright© 2010, Intel Corporation. All rights reserved. *Other brands and names are the property.
1 Pass Compiler 1. 1.Introduction 1.1 Types of compilers 2.Stages of 1 Pass Compiler 2.1 Lexical analysis 2.2. syntactical analyzer 2.3. Code generation.
CPSC Compiler Tutorial 9 Review of Compiler.
1 Semantic Processing. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
SIGCSE '05 Using the Rotor C# Compiler for Teaching Elizabeth White Computer Science Department George Mason University Fairfax, VA This work is supported.
Introduction & Overview CS4533 from Cooper & Torczon.
C Chuen-Liang Chen, NTUCS&IE / 1 COMPILER Chuen-Liang Chen Department of Computer Science and Information Engineering National Taiwan University Taipei,
Invitation to Computer Science 5th Edition
ACM SIGCSE ‘04 Using Real Compiler Source Code for Teaching Graduate Compiler Design Elizabeth White Nina Stewart Computer Science Department George Mason.
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.
Parser-Driven Games Tool programming © Allan C. Milne Abertay University v
CSC 338: Compiler design and implementation
Compiler Construction1 COMP Compiler Construction Lecturer: Dr. Arthur Cater Teaching Assistant:
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.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
CSC 230: C and Software Tools Rudra Dutta Computer Science Department Course Introduction.
Lexical Analysis I Specifying Tokens Lecture 2 CS 4318/5531 Spring 2010 Apan Qasem Texas State University *some slides adopted from Cooper and Torczon.
D. M. Akbar Hussain: Department of Software & Media Technology 1 Compiler is tool: which translate notations from one system to another, usually from source.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
CS453 LectureIntroduction1 CS453 Compiler Construction Instructor:Wim Bohm Computer Science Building 470 TA: tba
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.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
Introduction Lecture 1 Wed, Jan 12, The Stages of Compilation Lexical analysis. Syntactic analysis. Semantic analysis. Intermediate code generation.
Topic #1: Introduction EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
Overview of Previous Lesson(s) Over View  A program must be translated into a form in which it can be executed by a computer.  The software systems.
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.
COMPILER CONSTRUCTION Lesson 1 – TDDD16 TDDB44 Compiler Construction 2010 Kristian Stavåker (Erik Hansson.
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 1 Compiler Designs and Constructions Chapter 1: Introduction Objectives: Course Objectives Introduction Dr. Mohsen Chitsaz.
Compiler Construction By: Muhammad Nadeem Edited By: M. Bilal Qureshi.
The Model of Compilation Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
Course Overview for Compilers J. H. Wang Sep. 20, 2011.
What is a compiler? –A program that reads a program written in one language (source language) and translates it into an equivalent program in another language.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
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.
COMP 3002: Compiler Construction Pat Morin School of Computer Science.
Chapter 1 Introduction Samuel College of Computer Science & Technology Harbin Engineering 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.
CS 3304 Comparative Languages
Lexical and Syntax Analysis
Lecture 2 Lexical Analysis
CS 153: Concepts of Compiler Design August 29 Class Meeting
Chapter 1 Introduction.
-by Nisarg Vasavada (Compiled*)
Chapter 1: Introduction to Compiling (Cont.)
CS 153: Concepts of Compiler Design November 30 Class Meeting
Compiler Lecture 1 CS510.
CMPE 152: Compiler Design December 5 Class Meeting
Course supervisor: Lubna Siddiqui
Front End vs Back End of a Compilers
Introduction CI612 Compiler Design CI612 Compiler Design.
Compilers B V Sai Aravind (11CS10008).
COP4020 Programming Languages
CMPE 152: Compiler Design August 21/23 Lab
Compiler design.
Subject: Language Processor
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Compiler Construction
Lec00-outline May 18, 2019 Compiler Design CS416 Compiler Design.
Review of Previous Lesson
Faculty of Computer Science and Information System
Presentation transcript:

Using Real Compiler Source Code for Teaching Graduate Compiler Design Elizabeth White Nina Stewart Computer Science Department George Mason University Ranjan Sen Microsoft Corporation Washington DC This work is supported by SSCLI (Rotor) RFP 2

Graduate Compilers Typical courses in graduate compilers include: Theory Lexical analysis, Syntax analysis (LL/LR), Semantic analysis (typechecking, intermediate code generation, …) Development of a ‘compiler’ for a small language Use of theory Use of tools (e.g. Lex, YACC)

Graduate Compilers Typical courses in graduate compilers do not include: Access to ‘real’ compiler Access to ‘real’ runtime environment Why? Real compilers are extremely large and complex C# compiler 200,000+ lines of C++ 138 modules

Can we integrate ‘real’ compilers into a class like this? We think so. Idea: Show relevant details inside the compiler tied to input code Hide everything else  Hide and Show

Hide and Show Use a debugging tool on the compiler. Combine: Pre-chosen input program Pre-chosen breakpoints inside source code of the appropriate compiler component Step through the processing of input program and watch how the input program triggers changes. A carefully planned exercise of this type should provide insights that would be difficult to provide to the students using other techniques.

Hide and Show SSCLI (Rotor) C# compiler Concept Demonstration _parseNumber: fReal = TRUE; while (*p >= '0' && *p <= '9‘) p++; // Number + dot + non-digit -- these are separate tokens, so don't absorb the // dot token into the number. p = pszHold; pFT->iToken = TID_NUMBER; break; } } if (*p == 'E' || *p == 'e‘) { fReal = TRUE; // skip exponent p++; if (*p == '+' || *p == '-‘) p++; while (*p >= '0' && *p <= '9') p++; } … break; SSCLI (Rotor) C# compiler Target language Scanner Parser Semantic Analysis Code Generator Optimizer Symbol Table C# input file Concept Demonstration & Exploration Instructions: (debugger commands, breakpoints VisualStudio .net

Demo Platform: Rotor (SSCLI) C# compiler Visual Studio .net Concept: Lexical Analysis – How are tokens identified by the lexer? What happens to the input as tokens are found?

Should we integrate ‘real’ compilers into a class like this? Will there be value added? Strengthen understanding of how basic concepts apply? Strengthen understanding of inter-relationships between parts of a compiler? How to measure value added?

How should this be done? Classroom Directed exercises for individuals Would need strong visualization tools to be effective Directed exercises for individuals More promising (at least immediately) Could be assignment based

Current Status Basic concept demos Lexical Analysis Parsing Symbol Tables Need to find the best mechanism to allow students to independently use the demo. Integrated into graduate compilers Fall 2004.

Future How effective is this approach? What additional tools (such as visualization) would make this approach more effective? Expand to see how hide and show can be used at the ‘back-end’ of a compiler. What other areas/courses could this approach be effective in?

Questions?

Example Concept: Lexical Analysis – How are tokens identified by the lexer? What happens to the input stream as tokens are found? Illustration: watch the C# lexer work Set C# lexer variables to watch Set breakpoints in the C# lexer code Trace through parsing of C# input