Lecture 2 - Lexical Analysis Flashcards
?
is the first phase of a compiler.
WHAT IS LEXICAL ANALYSIS?
Lexical Analysis
?
It takes the modified source code from language preprocessors that are written in the form of sentences.
WHAT IS LEXICAL ANALYSIS?
Lexical Analysis
Lexical Analysis is the ? of a compiler
Lexical Analysis
WHAT IS LEXICAL ANALYSIS?
first phase
It takes the modified source code from ? that are written in the form of sentences.
Lexical Analysis
WHAT IS LEXICAL ANALYSIS?
language preprocessors
?
breaks these syntaxes into a series of tokens, by removing any whitespace or commentsin the source code.
WHAT IS LEXICAL ANALYSIS?
Lexical Analyzer
If the ? finds a token invalid, it generates an error.
WHAT IS LEXICAL ANALYSIS?
Lexical analyzer
?
It reads character streams from the source code, checks for legal tokens, and passes the data to the syntax analyzer when it demands.
WHAT IS LEXICAL ANALYSIS?
Lexical analyzer
The Lexical Analyzer breaks these syntaxes into a series of ?, by removing any ?? or comments in the source code.
Lexical analyzer
WHAT IS LEXICAL ANALYSIS?
- tokens
- whitespace
If the Lexical analyzer finds a token invalid, it generates an ?.
Lexical analyzer
WHAT IS LEXICAL ANALYSIS?
error
It reads character streams from the source code, checks for ?, and passes the data to the ??* when it demands.
Lexical analyzer
WHAT IS LEXICAL ANALYSIS?
- legal tokens
- syntax analyzer
?
is a sequence of characters (alphanumeric) in a token.
TOKENS AND LEXEMES
Lexemes
?
is a basic abstract unit of meaning.
TOKENS AND LEXEMES
Lexemes
?
Lexemes is a sequence of characters (?) in a token.
Lexemes
TOKENS AND LEXEMES
alphanumeric
?
There are some predefined rules for every lexeme to be identified as a ?.
Lexemes
TOKENS AND LEXEMES
valid token
?
is an object that represents something else.
TOKENS AND LEXEMES
Token
?
could be Keywords, Operators, Strings, Constants, Special Symbols, and Identifiers.
TOKENS AND LEXEMES
Tokens
?
(6) Tokens and Lexemes
TOKENS AND LEXEMES
- Keywords
- Identifiers
- Constants
- Strings
- Special Symbols
- Operators
?
are pre-defined or reserved words in a programming language.
TOKENS AND LEXEMES
Keywords
?
Each ? is meant to perform a specific function in a program.
TOKENS AND LEXEMES
Keywords - keyword
?
are used as the general terminology for naming of variables, functions and arrays.
TOKENS AND LEXEMES
Identifiers
?
their values can not be modified by the program once they are defined.
TOKENS AND LEXEMES
Constants