0% found this document useful (0 votes)
26 views3 pages

Parser and It's Types

A parser is used to break input into smaller elements from lexical analysis. It takes tokens as input and produces a parse tree as output. There are top-down and bottom-up parsing techniques, with top-down constructing the tree from the start symbol and bottom-up building up from the input symbols.

Uploaded by

Mehak Mirza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

Parser and It's Types

A parser is used to break input into smaller elements from lexical analysis. It takes tokens as input and produces a parse tree as output. There are top-down and bottom-up parsing techniques, with top-down constructing the tree from the start symbol and bottom-up building up from the input symbols.

Uploaded by

Mehak Mirza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

What is parser?

Parser is a compiler that is used to break the data into


smaller elements coming from lexical analysis phase.
A parser takes input in the form of sequence of tokens
and produces output in the form of parse tree.

Types of parser
1. Top down parsing
2. Bottom up parsing

What is Rules of parser?


When the parser starts constructing the parse tree from
the start symbol and then tries to transform the start
symbol to the input, it is called top-down parsing.
Recursive descent parsing : It is a common form of top-
down parsing. It is called recursive as it uses recursive
procedures to process the input.
Show the position of the parser in compiler
construction Via Diagram

Parser has two type


 Top Down parsing:
Recursive descent is a top-down parsing technique that
constructs the parse tree from the top and the input is
read from left to right. It uses procedures for every
terminal and non-terminal entity. This parsing technique
recursively parses the input to make a parse tree, which
may or may not require back-tracking.
 Bottom Up parsing:
Predive Parsing is a bottom-up parsing. Bottom up
parsing is also known as shift-reduce parsing. Bottom
up parsing is used to construct a parse tree for an input
string. In the bottom up parsing, the parsing starts with
the input symbol and construct the parse tree up to the
start symbol by tracing out the rightmost derivations of
string in reverse.

You might also like