Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 531 Compiler Construction Final Lecture of the Semester Spring 2010 Marco.

Similar presentations


Presentation on theme: "UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 531 Compiler Construction Final Lecture of the Semester Spring 2010 Marco."— Presentation transcript:

1 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 531 Compiler Construction Final Lecture of the Semester Spring 2010 Marco Valtorta

2 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Acknowledgment The slides are based on the textbook and other sources, including slides from Bent Thomsen’s course at the University of Aalborg in Denmark and several other fine textbooks The three main other compiler textbooks I considered are: –Aho, Alfred V., Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, & Tools, 2 nd ed. Addison-Welsey, (The “dragon book”) First edition, without the second author, was published in 1988 –Appel, Andrew W. Modern Compiler Implementation in Java, 2 nd ed. Cambridge, (Editions in ML and C also available; the “tiger books”) –Grune, Dick, Henri E. Bal, Ceriel J.H. Jacobs, and Koen G. Langendoen. Modern Compiler Design. Wiley, 2000

3 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Efficiency Efficiency is especially an issue for register machines –Example 9.5 –Hand-developed assembly code is faster Code transformations (“optimizations”) –Constant folding, including address folding for arrays and records (ex. 9.6) –Common expression elimination (ex. 9.7) –Code movement (ex. 9.8)

4 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Blocks and Data Flow Analysis Handout (dragon books: 9.4 [1988]) Partition into basic blocks Transformation on basic blocks –Common subexpression elimination –Dead code elimination –Renaming of temporary variables –Interchange of two independent adjacent statements Basic blocks form a flow graph

5 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Live Variable Analysis Handout (dragon book: [2007]) Could variable x at point p be used along some path in the flow graph starting at p?

6 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Language Lifecycle Language processors do not exist in a vacuum Waterfall, Iterative Development, RUDE Support for programming in the large and programming in the small is necessary –This goes beyond compiler design Waterfall requires support for design-by-contract Iterative development requires support for prototyping RUDE may be better supported by weaker typing

7 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Interpreters are everywhere on the web Web-Client Web-Server DBMS Database Output SQL commands PHP Script HTML-Form (+JavaScript) Reply WWW Submit Data Call PHP interpreter Response LAN Web-Browser Database Server

8 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Parallel Programming People still we do not know how to do parallel programming in an imperative style, and the machines are catching up! Solution 1: use a functional or logical style Solution 2: concentrate on numerical computation Solution 3: support specific computer architectures

9 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Compilers, Language Design, and Specifications It is hard to write informal specifications that are unambiguous –Example: repeat … until exercise It seems impossible to teach a compiler course without also teaching language design –Example: recursive data types

10 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Why Study PL Concepts? 1.Increased capacity to express ideas 2.Improved background for choosing appropriate languages 3.Increased ability to learn new languages 4.Better understanding of the significance of implementation 5.Increased ability to design new languages 6.Background for compiler writing 7.Overall advancement of computing 8.Distinguish essential from accidental features


Download ppt "UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 531 Compiler Construction Final Lecture of the Semester Spring 2010 Marco."

Similar presentations


Ads by Google