THE ROLE OF PARSER

THE ROLE OF PARSER

The parser or syntactic analyzer obtains a string of tokens from the lexical analyzer and verifies that the string can be generated by the grammar for the source language. It…
Syntax Analysis

Syntax Analysis

Syntax analysis or parsing is the second phase of a compiler. In this chapter, we shall learn the basic concepts used in the construction of a parser. We have seen…
Minimization of DFA

Minimization of DFA

DFA minimization stands for converting a given DFA to its equivalent DFA with minimum number of states. Minimization of DFASuppose there is a DFA D < Q, Σ, q0, δ,…
Regular Expressions

Regular Expressions

The lexical analyzer needs to scan and identify only a finite set of valid string/token/lexeme that belong to the language in hand. It searches for the pattern defined by the…
Finite Automata

Finite Automata

Finite automata is a state machine that takes a string of symbols as input and changes its state accordingly. Finite automata is a recognizer for regular expressions. When a regular…
RECOGNITION OF TOKENS

RECOGNITION OF TOKENS

Consider the following grammar fragment: stmt → if expr then stmt | if expr then stmt else stmt | ε expr → term relop term | term                            term →…
SPECIFICATION OF TOKENS

SPECIFICATION OF TOKENS

There are 3 specifications of tokens: 1)Strings 2) Language 3)Regular expression Strings and Languages ·         An alphabet or character class is a finite set of symbols. ·         A string over an alphabet is a finite sequence of…
Tokens

Tokens

Lexemes are said to be a sequence of characters (alphanumeric) in a token. There are some predefined rules for every lexeme to be identified as a valid token. These rules…
Roles of the Lexical analyzer

Roles of the Lexical analyzer

Lexical analyzer performs below given tasks: Helps to identify token into the symbol table Removes white spaces and comments from the source program Correlates error messages with the source program…