Preview

Compiler

Powerful Essays
Open Document
Open Document
32912 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Compiler
CS 375, Compilers: Class Notes

Gordon S. Novak Jr. Department of Computer Sciences University of Texas at Austin novak@cs.utexas.edu http://www.cs.utexas.edu/users/novak

Copyright c Gordon S. Novak Jr.1

A few slides reproduce figures from Aho, Lam, Sethi, and Ullman, Compilers: Principles, Techniques, and Tools, Addison-Wesley; these have footnote credits.

1

1

I wish to preach not the doctrine of ignoble ease, but the doctrine of the strenuous life. – Theodore Roosevelt

Innovation requires Austin, Texas. We need faster chips and great compilers. Both those things are from Austin. – Guy Kawasaki

2

Course Topics • Introduction • Lexical Analysis – Regular grammars – Hand-written lexical analyzer – Number conversion – Regular expressions – LEX • Syntax Analysis – Context-free grammars – Operator precedence – Recursive descent parsing – Shift-reduce parsing, YACC – Intermediate code – Symbol tables • Code Generation – Code generation from trees – Register assignment – Array references – Subroutine calls • Optimization – Constant folding, partial evaluation – Data flow analysis
3

Pascal Test Program

{ program 4.9 from Jensen & Wirth: graph1.pas } program graph1(output); const d = 0.0625; {1/16, 16 lines for [x,x+1]} s = 32; {32 character widths for [y,y+1]} h = 34; {character position of x-axis} c = 6.28318; {2*pi} lim = 32; var x,y : real; i,n : integer; begin for i := 0 to lim do begin x := d*i; y := exp(-x)*sin(c*x); n := round(s*y) + h; repeat write(’ ’); n := n-1 until n=0; writeln(’*’) end end. calling graph1 * * * * * * * * * * * * * * * * * * * * *

4

Introduction • What a compiler does; why we need compilers • Parts of a compiler and what they do • Data flow between the parts

5

Machine Language Machine language is the only language directly executable on a computer, but it is very hard for humans to write: • Absolute Addresses: hard to insert code. • Numeric Codes, e.g. remember. for operations: hard to

• Bit fields, e.g. for registers: hard to

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Homework Week 2

    • 743 Words
    • 3 Pages

    2. What does a compiler do? What kinds of errors are reported by a compiler?…

    • 743 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    Pt1420 Unit 1 Assignment 2

    • 1305 Words
    • 6 Pages

    Das, D., Gregersen, E., Hosch, L., Lotha, G., Sampaolo, M., Sinha, S. (2014). C++. In Encyclopedia Britannica.…

    • 1305 Words
    • 6 Pages
    Powerful Essays
  • Good Essays

    Comp 220

    • 1463 Words
    • 6 Pages

    Pointers also have the requirement that the pointer type must be of the same data type as the variable, or the data that it points to or holds the address of. The power of pointers also hints at the potential complexity of their use, which is why this lab is focused almost entirely on several different aspects and uses of pointers. The lab also introduces pointer arrays and pointers to pointers.…

    • 1463 Words
    • 6 Pages
    Good Essays
  • Good Essays

    pt1420 exam review

    • 738 Words
    • 3 Pages

    What is used to translate high level language programs to machine language (or machine code)? Compiler…

    • 738 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Week 1 Homework

    • 843 Words
    • 5 Pages

    2. What does a compiler do? What kinds of errors are reported by a compiler?…

    • 843 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Prg420 Syllabus

    • 1691 Words
    • 7 Pages

    Yelick, K., Hilfinger, P., Graham, S., Bonachea, D., Su, J., Kamil, A., et al. (2007, fall). Parallel languages and compilers: Perspective from the Titanium experience. International Journal of High Performance Computing Applications, 21(3), 266.…

    • 1691 Words
    • 7 Pages
    Satisfactory Essays
  • Satisfactory Essays

    CSO Gaddis Java Chapter1 1

    • 2953 Words
    • 29 Pages

    © 2012 Pearson Education, Inc. All rights reserved. Chapter 1: Introduction to Computers and Java Starting Out with Java: From Control Structures through Data Structures Second Edition by Tony Gaddis and Godfrey Muganda Chapter Topics Chapter 1 discusses the following main topics: – Introduction – Why Program? – Computer Systems: Hardware and Software – Programming Languages – What Is a Program Made Of? – The Programming Process –…

    • 2953 Words
    • 29 Pages
    Satisfactory Essays
  • Powerful Essays

    Reilly, E. D., Ralston, A., & Hemmendinger, D. (2000). Encyclopedia of computer science (4th ed.). London, England: Nature Pub. Group.…

    • 3614 Words
    • 15 Pages
    Powerful Essays
  • Good Essays

    It210 Syllabus

    • 2333 Words
    • 10 Pages

    Course Description This course provides students with a basic understanding of programming practices. Concepts covered include flowcharting, pseudocode methodologies, and an understanding of programming practices. Students will learn how these concepts, when properly applied, improve program design. Policies Faculty and students/learners will be held responsible for understanding and adhering to all policies contained within the following two documents: • • University policies: You must be logged into the student website to view this document. Instructor policies: This document is posted in the Course Materials forum.…

    • 2333 Words
    • 10 Pages
    Good Essays
  • Better Essays

    Samer Hassan and Rada Mihalcea and Carmen Banea Department of Computer Science University of North Texas samer@unt.edu, rada@cs.unt.edu, carmenb@unt.edu…

    • 6409 Words
    • 26 Pages
    Better Essays
  • Good Essays

    For several years the author was involved in a research project at a major aerospace corporation. The project studied techniques for program synthesis, automatic code generation, very high-level languages, graphical design tools and similar topics. The goal was to simplify specification of software systems and to make code synthesis practical by working in a restricted domain.…

    • 404 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Unix Operating System

    • 5458 Words
    • 22 Pages

    Quercia, Valerie, and O 'Reilly, Tim, X Window System User 's Guide, O 'Reilly & Associates, Inc., 1993 (for release 5)…

    • 5458 Words
    • 22 Pages
    Powerful Essays
  • Good Essays

    Introductions to Prolog

    • 2151 Words
    • 9 Pages

    Created around 1972 by Alain Colmerauer with Philippe Roussel, based on Robert Kowalski’s procedural interpretation of Horn clauses. decidable subset: Datalog, a query and rule language for deductive databases its failure as a mainstream language traditionally due to the following: Prolog usage in Fifth Generation Computer Systems project (FGCS) FCGS was an initiative by Japan’s Ministry of International Trade and Industry, begun in 1982, to create a "fifth generation computer"…

    • 2151 Words
    • 9 Pages
    Good Essays
  • Satisfactory Essays

    CompilerOptimization

    • 545 Words
    • 6 Pages

    Presentation on Compiler Design By Sandeep Negi Introduction What optimization is? Optimization at different levels. Pareto principle & Hotspots When to Optimize? Automated and Manual Optimization Classification of optimization technique Optimizing Transformations…

    • 545 Words
    • 6 Pages
    Satisfactory Essays
  • Powerful Essays

    An Overview of a Compiler

    • 1494 Words
    • 6 Pages

    Compiler overview with block diagram Lexical analysis with LEX Parsing with YACC Semantic analysis with attribute grammars Intermediate code generation with syntax-directed translation Code optimization examples…

    • 1494 Words
    • 6 Pages
    Powerful Essays