Preview

Compiler Construction

Good Essays
Open Document
Open Document
376 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Compiler Construction
Compiler-a program that translates an executable program in one language into an executable program in another language

Interpreter-a program that reads an executable program and produces the results of running that program

Why do we care to study compiler construction
Compiler construction is a microcosm of computer science artificial intelligence greedy algorithms learning algorithms
Algorithms
graph algorithms union-find dynamic programming
Theory
DFAs for scanning parser generators lattice theory for analysis
Systems
allocation and naming locality synchronization
Architecture
pipeline management hierarchy management instruction set use

Is Compiler construction not a solved problem?
Machines are constantly changing
Changes in architecture  changes in compilers new features pose new problems changing costs lead to different concerns old solutions need re-engineering
Innovations in compilers should prompt changes in architecture
New languages and features

What qualities are important in a good compiler?
1. Correct code
2. Output runs fast
3. Compiler runs fast
4. Compile time proportional to program size
5. Support for separate compilation
6. Good diagnostics for syntax errors
7. Works well with the debugger
8. Good diagnostics for flow anomalies
9. Cross language calls
10. Consistent, predictable optimization

What role does a Scanner plays in a compiler? map characters to tokens character string value for a token is a lexeme eliminate white space character string value for a token is a lexeme, Typical tokens: id, number, do, end …, Key issue is speed

Why the need for Parser? recognize context-free syntax guide context-sensitive analysis construct IR(s) produce meaningful error messages attempt error correction

Define a Context-free grammar-
Context-free syntax is specified with a grammar, usually in Backus-Naur form (BNF)

How are context-free grammars specified?

A grammar G = (S,N,T,P)
S is the start-symbol
N is a set of

You May Also Find These Documents Helpful

  • Better Essays

    Nt1310 Unit 4

    • 3614 Words
    • 15 Pages

    If the following program (myprog) is run from the command line as myprog 1 2 3, What would be the output?…

    • 3614 Words
    • 15 Pages
    Better Essays
  • Better Essays

    DSC 340 Midterm

    • 1391 Words
    • 6 Pages

    computer program or collection of programs-set of instructions that tell the hardware what to do…

    • 1391 Words
    • 6 Pages
    Better Essays
  • Good Essays

    Unit 16 Ao1

    • 529 Words
    • 3 Pages

    All programs are written to do something, their purpose may be to perform a calculation or to run a computer game, but all programs will perform a task, also known as a process. All programs take the stricter of input, process to output. Th input includes user controls such as keyboard, mouse, game controller, voice and so on. It will also include data from the user, computer or other programs.…

    • 529 Words
    • 3 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

    5. Bob enters a pizza shop and notices there are three different sizes of pizzas available. Sizes are given as the diameter of the pizza in inches. The cost of a pizza is based on the size. Bob would like to know which size of pizza has the lowest cost per square inch.…

    • 843 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Compilation Report

    • 283 Words
    • 2 Pages

    We have compiled the accompanying balance sheet of Proli Footwear, Inc. as of December 31, 2014, and the related statements of income and retained earnings and cash flows for the year then ended. We have not audited or reviewed the accompanying financial statements and, accordingly, do not express an opinion or provide any assurance about whether the financial statements are in accordance with accounting principles generally accepted in the United States of America.…

    • 283 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    To apply the stored-program concept, central processing unit (CPUs) are designed to recognize instructions encoded as bit patterns. This collection of instructions along with the encoding system is called the machine language. An instruction expressed in this language is called a machine-level instruction or, more commonly, a machine instruction.…

    • 458 Words
    • 2 Pages
    Good Essays
  • Better Essays

    The Declaration and Address’ intended audience was all who love our Lord Jesus Christ. The intended audience ties in with the message of most of the document in that it speaks of unity. A major part of the Stone-Campbell Movement was to bring unity and the Stone-Campbell Movement was formed through unity. I think a couple of the main reasons why unity is so important in the document was one, because God calls us to unity through Him, and two, because the Stone-Campbell Movement was created through unity. If Stone and Campbell stayed separate in their thoughts, beliefs, and motives the impact they were able to have would not have happened. The importance of unity is far beyond describing. When there is not unity in the Church, then the Church will fall. Division makes anything weak. That is why the topic of unity is discussed with such importance.…

    • 861 Words
    • 4 Pages
    Better Essays
  • Good Essays

    IMPORTANT: Questions 1, 2 and 4 apply to the prefuse system provided in the specified repository. Question 1. Intra-method Control Flow (Flowchart) [7 points] Draw a flowchart for the void clearAggregateMappings(int row, boolean update) method defined in the AggregateTable class of the prefuse.visual package.…

    • 1717 Words
    • 7 Pages
    Good Essays
  • Good Essays

    The compiler adds a symbol table to the executable so that variable names from the source code can be understood. The compiler avoids optimizing operations so that lines of code in the executable can be related to the original lines of source code.…

    • 567 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Recco Smith Unit 1 HmWrk

    • 1114 Words
    • 4 Pages

    6. What Is the different between a compiler and an interpreter? Interpreter is a program that both translate and execute the instructions in high-level language program. Where as, Compiler is used to translate the high-level language program to a machine language program.…

    • 1114 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    Is375

    • 4800 Words
    • 20 Pages

    IS375 Object-Oriented Analysis and Design Object-Oriented Analysis and Design How to build a Software Application? 1. Blue print 1. Diagrams 2. Tools 2.…

    • 4800 Words
    • 20 Pages
    Powerful Essays
  • Best Essays

    Let I be the set of input devices, O be the set of output devices, and let P be the program.…

    • 2205 Words
    • 9 Pages
    Best Essays
  • Good Essays

    Syntax and Parsing

    • 12787 Words
    • 77 Pages

    ambiguity is a particularly difficult problem since the most plausible analysis has to be chosen from an exponentially large number of alternative…

    • 12787 Words
    • 77 Pages
    Good Essays
  • Satisfactory Essays

    Program- set (finite) of instructions properly sequenced that can be executed by the computer will lead to the desired output…

    • 847 Words
    • 4 Pages
    Satisfactory Essays

Related Topics