Beruflich Dokumente
Kultur Dokumente
CONTENTS
• INTRODUCTION
• AIM OF THE PROJECT
• PURPOSE OF THE PROJECT
• SYSTEM DESIGN
• GOALS
• SCOPE OF PROJECT
INTRODUCTION
• Lexical analyzer converts stream of input characters into a stream of tokens. The different tokens that our
lexical analyzer identifies are as follows:
• KEYWORDS: int, char, float, double, if, for, while, else, switch, struct, printf, scanf, case, break, return,
typedef, void
• IDENTIFIERS: main, fopen, getch etc
• NUMBERS: positive and negative integers, positive and negative floating point numbers.
• OPERATORS: +, ++, -, --, ||, *, ?, /, >, >=, <, <=, =, ==, &, &&.
• BRACKETS: [ ], { }, ( ).
• STRINGS: Set of characters enclosed within the quotes
• COMMENT LINES: Ignores single line, multi line comments
• For tokenizing into identifiers and keywords we incorporate a symbol table which initially consists of
predefined keywords. The tokens are read from an input file. If the encountered token is an identifier or a
keyword the lexical analyzer will look up in the symbol table to check the existence of the respective token. If
an entry does exist then we proceed to the next token. If not then that particular token along with the token
value is written into the symbol table. The rest of the tokens are directly displayed by writing into an output
file.
AIM OF THE PROJECT
• Aim of the project is to develop a Lexical Analyzer that can generate
tokens for the further processing of compiler.
PURPOSE OF THE PROJECT
• Lexical analyzer converts the input program into character stream of valid
words of language, known as tokens.
• The parser looks into the sequence of these tokens & identifies the
language construct occurring in the input program. The parser and the
lexical analyzer work hand in hand; in the sense that whenever the parser
needs further tokens to proceed, it request the lexical analyzer. The lexical
analyzer in turn scans the remaining input stream & returns the next token
occurring there. Apart from that, the lexical analyzer also participates in
the creation & maintenance of symbol table. This is because lexical
analyzer is the first module to identify the occurrence of a symbol. If the
symbol is getting defined for the first time, it needs to be installed into the
symbol table. Lexical analyzer is most widely used for doing the same.