Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 614: Theory and Construction of Compilers Lecture 8 Fall 2003 Department of Computer Science University of Alabama Joel Jones.

Similar presentations


Presentation on theme: "CS 614: Theory and Construction of Compilers Lecture 8 Fall 2003 Department of Computer Science University of Alabama Joel Jones."— Presentation transcript:

1 CS 614: Theory and Construction of Compilers Lecture 8 Fall 2003 Department of Computer Science University of Alabama Joel Jones

2 Lecture 8©2003 Joel Jones2 Outline Tombstone diagrams Reading for next time

3 Lecture 8©2003 Joel Jones3 Language Processors Give definitions of the following: Translator Compiler Source program Object (target) program

4 Lecture 8©2003 Joel Jones4 Tombstone Diagrams Program Machine Translators Interpreters

5 Lecture 8©2003 Joel Jones5 Definitions P L MST L P L Program P expressed in language L Machine M Translator from S to T expressed in L Program P expressed in language L

6 Lecture 8©2003 Joel Jones6 Example Programs sort Ada chess LISP sort x86 sort program expressed in Ada chess program expressed in LISP sort program expressed in x86 machine code

7 Lecture 8©2003 Joel Jones7 Example Machines x86PPCSPARC Intel x86 family machine PowerPC machine (Apple, IBM) SPARC machine (Sun workstations and servers)

8 Lecture 8©2003 Joel Jones8 Example Translators Cx86 C compiler on x86 for x86 AdaPPC x86 Cross compilation: Ada compiler on x86 for PPC sort Ada x86 sort PPC sort PPC

9 Lecture 8©2003 Joel Jones9 Example Translators (cont.) AdaC x86 sort Ada x86 sort C Cx86 sort x86 Two-stage compilation x86

10 Lecture 8©2003 Joel Jones10 Tombstone Diagram Problems 1: (machine M, Triangle compiler for M, disassembler for M) Diagrams for above Compile a Triangle Source Program P Running the object program Disassembling the object program 2: (machine M, C compiler on M producing M, Java->C translator written in C) Diagrams for above Compile and run program P expressed in C Compile Java-into-C translator to machine code Compile and run program Q expressed in Java

11 Lecture 8©2003 Joel Jones11 More Tombstone Diagram Problems 3: (Gnu RTL intermediate language; HLL: C, C++, Pascal; Machine Code: Alpha, PPC, SPARC; RTL->RTL optimizer; all written in C Install on SPARC, given a C compiler for SPARC Compile P in Pascal, into SPARC machine code Compile using RTL optimizer Cross-compile C++ program Q for PPC machine code

12 Lecture 8©2003 Joel Jones12 Reading & Questions for Next Class Catalog of refactorings http://www.refactoring.com/catalog/index.htm l http://www.refactoring.com/catalog/index.htm l


Download ppt "CS 614: Theory and Construction of Compilers Lecture 8 Fall 2003 Department of Computer Science University of Alabama Joel Jones."

Similar presentations


Ads by Google