COP4620 – Programming Language Translators Dr. Manuel E. Bermudez

Slides:



Advertisements
Similar presentations
1 If we modify the machine for the language from F12 p. 47 we can easily construct a machine for the language Observation Turing machine for the language.
Advertisements

1/18 CS 693/793 Lecture 09 Special Topics in Domain Specific Languages CS 693/793-1C Spring 2004 Mo, We, Fr 10:10 – 11:00 CH 430.
T-diagrams “Mommy, where do compilers come from?” Adapted from:
1 Programming Languages b Each type of CPU has its own specific machine language b But, writing programs in machine languages is cumbersome (too detailed)
1.1 Introduction to Language Processor
3-1 3 Compilers and interpreters  Compilers and other translators  Interpreters  Tombstone diagrams  Real vs virtual machines  Interpretive compilers.
Language processors (Chapter 2) 1 Course Overview PART I: overview material 1Introduction 2Language processors (tombstone diagrams, bootstrapping) 3Architecture.
What have mr aldred’s dirty clothes got to do with the cpu
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
Execution of an instruction
C o n f i d e n t i a l 1 Course: BCA Semester: III Subject Code : BC 0042 Subject Name: Operating Systems Unit number : 1 Unit Title: Overview of Operating.
CS 614: Theory and Construction of Compilers Lecture 7 Fall 2002 Department of Computer Science University of Alabama Joel Jones.
CS 614: Theory and Construction of Compilers Lecture 8 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
Chapter 1: Introduction 1 Compiler Designs and Constructions Chapter 1: Introduction Objectives: Course Objectives Introduction Dr. Mohsen Chitsaz.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
Language Implementation Methods David Woolbright.
Chapter 2- Visual Basic Schneider1 Programming Languages: Machine Language Assembly Language High level Language.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Computer Language
Why don’t programmers have to program in machine code?
Advanced Computer Systems
Programming what is C++
Introduction Chapter : Introduction.
Overview of Compilers and Language Translation
Topic: Programming Languages and their Evolution + Intro to Scratch
Compiler, Interpreter, and Bootstrapping
Chapter 5- Assembling , Linking, and Executing Programs
Language Translation Compilation vs. interpretation.
Computer Programming.
Introduction to Parsing (adapted from CS 164 at Berkeley)
Overview of Compilation The Compiler Front End
Overview of Compilation The Compiler Front End
Fixing non-ll(1) grammars
Creativity in Algorithms
More Interfaces, Dynamic Binding, and Polymorphism
Want to Write a Compiler?
Entry Ticket: High and Low Level Languages
2.1. Compilers and Interpreters
Regular grammars Module 04.1 COP4020 – Programming Language Concepts Dr. Manuel E. Bermudez.
COP4620 – Programming Language Translators Dr. Manuel E. Bermudez
and Executing Programs
Programming Languages
Creativity in Algorithms
Bottom-up AST, original grammar
Bottom-up derivation tree, original grammar
TaBle-driven LL(1) Parsing
Replacing recursion with iteration
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
Overview of Compilation The Compiler BACK End
Bottom-up AST, original grammar
TaBle-driven LL(1) Parsing
DFA-> Minimum DFA Module 05.4 COP4020 – Programming Language Concepts Dr. Manuel E. Bermudez.
Programming Language Translators
NFA->DFA Module 05.3 COP4020 – Programming Language Concepts Dr. Manuel E. Bermudez.
COP4620 – Programming Language Translators Dr. Manuel E. Bermudez
COP4620 – Programming Language Translators Dr. Manuel E. Bermudez
Fixing non-ll(1) grammars
22.1 Probability and Set Theory ACTIVATE PRIOR KNOWLEDGE
Processor Fundamentals
Regular Expression to NFA
Compiler Writing Source Language Issues
Replacing recursion with iteration
The Purpose of this Course
An Introduction to Programming with C++ Fifth Edition
COP46– Programming Language Translators Dr. Manuel E. Bermudez
Paradigms and paradigm shifts
Introduction Chapter : Introduction.
Presentation transcript:

COP4620 – Programming Language Translators Dr. Manuel E. Bermudez Bootstrappping COP4620 – Programming Language Translators Dr. Manuel E. Bermudez

Bootstrapping Definition Example: A Compiler for C Cross-compiling Topics Bootstrapping Definition Example: A Compiler for C Cross-compiling

Bootstrapping The notion of implementing a language, by means of using (part of) that language’s own implementation. Notation: T-diagram Source Target Language Written in

T-diagrams C M APPLICATION Source Coincides Object Coincides Execution

Bootstrapping Example: We wish to have a C compiler for a new processor, M. How do we get it ? Possibility #1: Write the compiler directly by hand, in machine language? In assembly language ?  C M

Bootstrapping Possibility # 2: Write the C compiler in some other language L, that is already implemented on M. Then, compile the compiler. But, ... this is probably still too much work. L M C M C M L Compiler

Bootstrapping Possibility # 3: T M First, implement T, a subset of C. Now, T is implemented. Then, write the desired compiler in T, and compile it. L M T M T M C M

Bootstrapping If T is choosen well, the T  M compiler and the C  M compiler (in T) together, are easier to write than the C  M (in L) compiler. Theoretically, this process can go on indefinitely, bootstrapping up the level of the language. In practice, however, new constructs interfere with each other (and with old ones), until further bootstrapping becomes ummanageable.

Bootstrapping Now, lets suppose we wish to port C to a new machine, M’. Possibility #1: Same as for M. Possibility #2: Same as for M. Possibility #3: Same as for M.

Bootstrapping Possibility # 4: T M’ Step 1: Same as for M (implement T on M’). Step 2: Modify the C M compiler, to generate code for M’. Then, compile the compiler. L M’ T M’ T M’ C M’

Bootstrapping Possibility # 5 C M’ (cross-compiling): Don’t use T ! Instead, use implementation of C on M. Step 1: Step 2: Compile the compiler (on M). C M C M’ Cross-compiler C M’ M C M’

Bootstrapping Definition Example: A Compiler for C Cross-compiling summary Bootstrapping Definition Example: A Compiler for C Cross-compiling