Preview

Lexical Analyzer

Powerful Essays
Open Document
Open Document
2938 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Lexical Analyzer
Lexical Analysis

Made with OpenOffice.org

1

The role of lexical analyzer: analyzer:
It is the first phase of a compiler. compiler. Its main task is to read the input characters & produce as output a sequence of tokens that the parser uses for syntax analysis. analysis. Upon receiving a “get next token” command from the parser, the lexical analyzer reads input characters until it can identify the next token. token. It may also perform certain secondary tasks at the user interface. interface. One such task is stripping out from the source program comments & white spaces in the form of blank, tab, & new – line characters. characters. Another is correlating error messages from the compiler with the source program. program.

Made with OpenOffice.org

2

The role of lexical analyzer (cont…): (cont…
It may keep track of the number of new – line characters seen, so that a line number can be associated with an error message. message. In some compilers, the lexical analyzer is in charge of making a copy of the source program with the error messages marked in it. it.

Made with OpenOffice.org

3

Issues in lexical analysis: analysis:
There are several reasons for separating the analysis phase of compiling into linear analysis and hierarchical analysis. analysis. Simpler design is perhaps the most important consideration. The separation of consideration. lexical analysis from syntax analysis often allows to simplify one or the other of these phases. phases. Compiler efficiency is improved. A separate lexical analyzer allows to construct a improved. specialized & potentially more efficient processor for the task. A large amount of time task. is spent reading the source program & partitioning it into tokens. Specialized tokens. buffering techniques for reading input characters & processing tokens can significantly speed up the performance of a compiler. compiler. Compiler portability is enhanced. Input alphabet peculiarities & other device– enhanced.

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

    It parses and also executes the statement Displays the execution plan for the select statement automatically…

    • 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

    Unit 3 research

    • 481 Words
    • 2 Pages

    Someone doing reverse engineering on software may use several tools to disassemble a program. One tool is a hexadecimal dumper, which prints or displays the binary numbers of a program in hexadecimal format (which is easier to read than a binary format). By knowing the bit patterns that represent the processor instructions as well as the instruction lengths, the reverse engineer can identify certain portions of a program to see how they work. Another common tool is the disassembler. The disassembler reads the binary code and then displays each executable instruction in text form. A disassembler cannot tell the difference between an executable instruction and the data used by the program so a debugger is used, which allows the disassembler to avoid disassembling the data portions of a program. These tools might be used by a cracker to modify code…

    • 481 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Cs Programming Chapter 1

    • 2450 Words
    • 10 Pages

    ____ errors are relatively easy to locate and correct because the compiler or interpreter you use highlights every error.…

    • 2450 Words
    • 10 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Cabecion: Word Analysis

    • 219 Words
    • 1 Page

    A label I dislike being called is "cabecion," which means big head in spanish. I got labeled that as a kid because I had an afro and it made my head look bigger than it was. Later my cousins would make fun of me for being labeled big head. This holds a connactive meaning of being an airhead or dumb. A strategie that I used to get people to stop calling me was getting a low haircut.…

    • 219 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    LANGUAGE ANALYSIS

    • 593 Words
    • 2 Pages

    This formal newsletter was written on 19th of September, 2012 by Dr John K McGuire P.H.D, MOA, and Principal of Turramurra Christian Grammar School. It appeared in the Parents Newsletter as a response to concerns raised, regarding mobile phones. The Principal is announcing the school’s Board decision that they have ban phones because they are distractive and problematic. The Principal supports the school ban. The writers tone is formal, direct, authoritative and forceful.…

    • 593 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    I Like to 1321

    • 459 Words
    • 2 Pages

    statement. Also included is a for loop (repetition statement). Pay close attention to these as you…

    • 459 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    In the novel, A Tale of Two Cities Charles Dickens opens with an anaphora, about how the world is throughout the novel. A reoccurring theme throughout this story is the battle between good and evil. Most of the novel is about the struggles each force has and how most of the time good triumphs over evil. In A Tale of Two Cities, the triumph of love, the death of the Marquis, and the contrast between Sydney Carton and Charles Darnay shows how good triumphed over evil.…

    • 718 Words
    • 3 Pages
    Good Essays
  • Better Essays

    Language Analysis

    • 1083 Words
    • 5 Pages

    ‘They were a weird mob, the Australians of 2013’ is written by Hugh Mackay and is an opinion piece that appeared in The Saturday Age on the 26th of January, 2013. It discusses the issues that are currently facing Australia and how as a nation these problems are still left unaddressed. Hugh Mackay believes that addressing these issues will improve our Australian identity and bring us closer together as a nation. He attempts to communicate with as many Australians as he can with these various issues such as asylum seekers, different school funding, global warming and tries to target those that may have a vested interest. He communicates with his wider audience in a condescending tone and presents his opinion in a satirical form by pretending to be from 50 years into the future.…

    • 1083 Words
    • 5 Pages
    Better Essays
  • Good Essays

    |This module requires students to explore and analyse texts used in a | |affect the language and structure of texts. |…

    • 2613 Words
    • 11 Pages
    Good Essays
  • Good Essays

    Language analysis

    • 447 Words
    • 2 Pages

    In the opinion article "One too many" that was published in the herald sun band written by Fiona McCormack, the authors main contention was that the government should support improving the system response to family violence. Serious and concerned tone was used with persuasive techniques such as evidence, rhetorical question and inclusive language to persuade the reader to agree with the authors viewpoint.…

    • 447 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Opac or

    • 1068 Words
    • 5 Pages

    is a method by which individual units of source code are tested to determine if they are fit for use.…

    • 1068 Words
    • 5 Pages
    Powerful Essays

Related Topics