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

  • 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
  • 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

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

    • 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

    It is useful for a compiler to be able to grow the symbol table dynamically at compile time. If the symbol table is fixed when the compiler is written, the size must be chosen large enough to handle any source program that might be presented.…

    • 1792 Words
    • 8 Pages
    Better Essays
  • Good Essays

    Language Synthesis Essay

    • 325 Words
    • 2 Pages

    Language and how we communicate is an intricate system, made up of rules and processes that ultimately affect the delivery of meaning amongst a group of people (Fellowes & Oakley, 2014, p. 32). This system can be broken down into five areas that are; phonology, lexis, orthography, semantic and syntax (Gardener, 2017a). Therefore, as this system's taught, the development of language should evolve (Fellowes & Oakley, 2014). The syntax is an important area of this complex system and comprises of how people make meaning of words and how they are used to produce an unlimited number of sentences (Fromkin & Hyams, 2012, p. 98). Sentences are formed using words, clauses and phrases and syntax assists with these sentences to have meaning and sound accurate…

    • 325 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Java Cis Assignment 1

    • 674 Words
    • 3 Pages

    1(a) Delimiters are used as comments. The Phrase is put in there to be shown to the user whilst programming, but is not shown when the program is to run.…

    • 674 Words
    • 3 Pages
    Satisfactory 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
  • Powerful Essays

    Java Exception Handling

    • 7853 Words
    • 32 Pages

    This part introduces the use of exception handling and assertions to make your programs robust and correct, the use of input and output to manage and process a large quantity of binary data, and the use of recursion to write methods for solving inherently recursive problems.…

    • 7853 Words
    • 32 Pages
    Powerful 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