Preview

Compiler Design Phases

Good Essays
Open Document
Open Document
377 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Compiler Design Phases
Lexical Analysis: * Stream of characters in the source program is grouped into meaningful sequences called lexemes. Tokens are produced for each lexeme. A token is an abstract symbol generated during lexical analysis. * Generally, a token has an attribute value attached to it. It denotes the position of the variable in a symbol table. A symbol table is a table which stores information about an identifier and is referred at various stages of compilation.

Syntax Analysis: * The syntax analyzer checks each line of the code and spots every tiny mistake that the programmer has committed while typing the code. * The compiler follows a detailed procedure using the tokens creates by the lexical analyzer and creates a tree-like structure called the syntax tree. * The syntax analyzer checks whether the order of tokens conform to the rules of the programming language. Unmatched parenthesis, missing semicolons are some of the errors detected in this phase. * If there are no errors in the code, the syntax analyser successfully constructs a syntax tree which is later used by the semantic analyser.

Semantic Analysis: * “Semantic” by definition is concerned with meanings. A semantic analyser is mainly concerned with what the program means and how it executes. * Type checking is an important aspect of semantic analysis where each operator should be compatible with its operands.

Intermediate Code Generation * A compiler may construct intermediate representations while converting a source program to a target program. * The representation should be easy to convert into a target language. It is then passed onto the second phase of compiler design: the synthesis phase. This phase involves the actual construction of target program and includes code optimisation and code generation.

Code Optimization * As the name suggests, this phase aims at optimising the target code. * The code can be optimised in terms of time taken to

You May Also Find These Documents Helpful

  • Satisfactory Essays

    5. In process window select check syntax for checking the syntax shown in figure 5. After successful completion of check syntax generate syntax report in…

    • 419 Words
    • 2 Pages
    Satisfactory Essays
  • 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
  • Better Essays

    Service Request Sr Rm 004

    • 1582 Words
    • 7 Pages

    This phase requires the coordination and cooperation of many people. The system analyst cannot conduct all the work alone. The first step involves coding. Coding is process of converting writing computer language that tells the system the commands to perform when certain commands are given. As the coding process being, the process of testing is also taking place as well. When coding is written, it must pass validation or the computer will not understand the language and the expect program will not perform to standard. Many strategies are available for testing validation; the size of the system dictates which is best. Throughout the system development life cycle, software testing was taking place after certain events to ensure the preliminary creation was on track. During analysis the overall test plan was developed. In the design phase, the unit test, integration test plan, and a system test plan was developed. Inspections are formal group activities that perform manually to find obvious errors such as syntax and…

    • 1582 Words
    • 7 Pages
    Better 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
  • Powerful Essays

    Nt1310 Unit 1

    • 4209 Words
    • 17 Pages

    If two steps are indented at the same level, the uppermost statement is executed first. ans)All of the above…

    • 4209 Words
    • 17 Pages
    Powerful Essays
  • Good Essays

    pt1420 exam review

    • 738 Words
    • 3 Pages

    The words that make up a high level programming language are known as what? Keywords…

    • 738 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Prg 211

    • 393 Words
    • 2 Pages

    Branching is controlled by conditional test statements. The statement is executed once the test condition is met. The branch will flow in a certain direction depending on the criteria that was input. Otherwise, sequential flow of statement will be directed to other area of the program.…

    • 393 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    f. The set of all strings consisting of the keyword begin, followed by zero or more statements with a semicolon after each one, followed by the keyword end. Use the non-terminal for statements, and do not give productions for it.…

    • 470 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    (): The parentheses aren’t true wildcards, not in a matching sense. They allow you to divide a pattern into logical sequences.…

    • 404 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Macro Examples

    • 1120 Words
    • 5 Pages

    7. The If…Then…Else…End If code allows code to be conditionally executed depending on whether a specified logical condition has been met.…

    • 1120 Words
    • 5 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
  • Better Essays

    Symbol Table

    • 1792 Words
    • 8 Pages

    Information is entered into the symbol table at various times. Keywords are entered initially. The lexical analyzer looks up sequences of letters and digits in the symbol table to determine if a reserved keyword or a name has been collected. With this approach, keywords must be in the symbol table before lexical analysis begins. Alternatively, if lexical analyzer intercepts reserved keywords, they should be entered into the symbol table with a warning of their possible…

    • 1792 Words
    • 8 Pages
    Better Essays
  • Better Essays

    Lingustic

    • 2897 Words
    • 12 Pages

    phpSyntaxTree - drawing syntax trees made easy." ironcreek.net :: welcome. N.p., n.d. Web. 12 Sept. 2012. .…

    • 2897 Words
    • 12 Pages
    Better Essays
  • Good Essays

    The screen grab of the tool execution identifying the occurrence of data-flow interference is given in Fig. 4. In the case study application, a variable no_of_students is used by both register and unregister functionalities. The value of no_of_students is incremented when a new student registers for a course and gets decremented when a student unregisters from the course. The data-flow interference occurs when variable no_of_students is not updated according to the functionalities (i.e) if the value giveed to no_of_students is not correctly updated, then marks may be giveed to an unregistered student by the Professor during the execution of give marks…

    • 745 Words
    • 3 Pages
    Good Essays

Related Topics