Preview

Compiler Design

Good Essays
Open Document
Open Document
7419 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Compiler Design
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 2007-2008, EVEN SEMESTER PRINCIPLES OF COMPILER DESIGN-CS1352 TWO-MARK QUESTIONS 1. What does translator mean? A translator is a program that takes a input program on one programming language (source language) and produces output in another language (object language or target language). 2. What are the phases of a compiler? • Lexical analysis phase or scanning phase • Syntax analysis phase • Intermediate code generation • Code optimization • Code generation 3. What is the role of lexical analysis phase? Lexical analyzer reads the source program one character at a time, and grouped into a sequence of atomic units called tokens. Identifiers, keywords, constants, operators and punctuation symbols such as commas, parenthesis, are typical tokens. 4. Define lexeme? The character sequence forming a token is called lexeme for the token. 5. What are the two functions of parser?  It checks the tokens appearing in its input, which is output of the lexical analyzer.  It involves grouping the tokens of source program into grammatical phrases that are used by the compiler to synthesize the output. Usually grammatical phrases of the source program are represented by tree like structure called parse tree. 6. Mention the role of semantic analysis? Semantic analysis checks the source program for semantic errors and gathers information for the subsequent code-generation phase. It uses hierarchical structure to identify the operators and operands of expressions and statements. An important component of semantic analysis is type checking .In type checking the compiler checks that each operator has operands that are permitted by the source language specification.

In such cases, certain programming language supports operand coercion or type coercion also. 7. Name some variety of intermediate forms. o Postfix notation or polish notation. o Syntax tree o Three address code o Quadruple o Triple

8. Write the syntax for

You May Also Find These Documents Helpful

  • Satisfactory Essays

    The second category of fault changes individual instructions in the text segment. These faults are intended to approximate the assembly-level manifestation of real C-level programming…

    • 285 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    In this phase a token is generated against all the lexemes in the source code. These lexemes and tokens are stored in the Symbol Table. Tokens against the lexemes are generated based on some patterns or rules.…

    • 703 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Homework Week 2

    • 743 Words
    • 3 Pages

    A compiler translates one computer language into another. It also pics up errors in the program being put together.…

    • 743 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    pt1420 exam review

    • 738 Words
    • 3 Pages

    What is a set of statements that execute in the order that they appear? Sequence Structure…

    • 738 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    EAS230Syllabus

    • 1748 Words
    • 8 Pages

    C++ programming: editing, compiling, user I/O, variables (ints, doubles, char, strings, booleans), loops, decisions, functions, pointers, arrays, tables, databases, sorting.…

    • 1748 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    Unit 6 Assignment 2 Choosing the right programming language. (P2) There are several factors to consider when choosing the right programming language, these include Organisational policy, suitability in terms of available features and tools, availability of trained staff and development and maintenance costs. Organisational policy Organisations which make and develop loads of computer software’s and programs tend to have a policy of using a certain language, a reason for this might be because that language allows them to make all their software consistent and easier to maintain.…

    • 1542 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    a.x is available to code that is written outside the Sphere class. b.radius is not available to code written outside the Sphere class. c.radius, x, y, and z are called members of the Sphere class. d.z is available to code that is written outside the Sphere class.…

    • 1368 Words
    • 9 Pages
    Satisfactory Essays
  • Satisfactory Essays

    “This article describes programmability studies undertaken by Sun Microsystems in its HPCS participation.” FORTRAN has been the preferred language among the High Performance Computing (HPC) community, it is less likely that every programmer would have ended up preferring FORTRAN and more likely that the problems with the original source codes have more to do with reasons than the limitations of existing programming languages. The need for HPC benchmarks in the new languages could reduce source-code volume substantially, but rewriting these benchmarks even in FORTRAN could achieve similar source-code reductions and corresponding improvements in expressivity. This article mentions that the programmer rewrote many of HPC benchmarks and applications using modern FORTRAN taking into account the human costs of software development: programmability and associated characteristics such as readability, verifiability, and maintainability. “These are important considerations; although copy-and-paste is a fast way of writing lines of code, it degrades readability and increases maintenance costs.”…

    • 630 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Java Programming I Exam

    • 912 Words
    • 4 Pages

    Locating and repairing all syntax errors is part of the process of ____ a program.…

    • 912 Words
    • 4 Pages
    Satisfactory 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
  • Better Essays

    The sender should consider the components of language when preparing their message. The components of language include phonemes, syntax, semantics, and pragmatics (Thomas Cheesebro, Linda O'Connor, Franciso Rios, University of Phoenix, 2010). The components of language can be used to provide the foundation of the intended message ensuring the message is delivered both appropriately and effectively. “Phonemes represent the sound system of a language and are often the smallest level the language is understood” (Thomas Cheesebro, Linda O'Connor, Franciso Rios, University of Phoenix, 2010). Syntax places the focus on the patterns or structures (including the rules for structure) of a language (Thomas Cheesebro, Linda O'Connor, Franciso Rios, University of Phoenix, 2010). Semantics puts a focus on the meaning of the words (Thomas Cheesebro, Linda O'Connor, Franciso Rios, University of Phoenix, 2010). Pragmatics focuses…

    • 1108 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    Programming fundamentals

    • 299 Words
    • 2 Pages

    Note. This assignment is cumulative and the information and results will be used in the following weeks.…

    • 299 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Which of the following is NOT considered to be one of the three basic features of a…

    • 1228 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    Compiling

    • 18744 Words
    • 75 Pages

    gcc -o / -O option flags gcc -o writes the build output to an output file. gcc -O sets the compiler's optimization level. gcc -o option flag gcc -O option flag gcc -o option flag Write the build output to an output file. Syntax $ gcc [options] [source files] [object files] -o output file Example myfile.c: // myfile.c #include void main() { printf("Program run\n"); } Build myfile.c on terminal and run the output file myfile: $ gcc myfile.c -o myfile $ ./myfile…

    • 18744 Words
    • 75 Pages
    Satisfactory Essays
  • Powerful Essays

    Compilation in Informatics

    • 1567 Words
    • 7 Pages

    This study aims to study the use of a mobile app for patient education to (1) quantify patient interest, (2) determine desirable features and (3) determine if a relationship exists between patient variables and interest…

    • 1567 Words
    • 7 Pages
    Powerful Essays

Related Topics