MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Shift Reduce parser is an example of
A
Top down parsing
B
Bottom up parsing
C
Either A or B
D
None of the above
Explanation: 

Detailed explanation-1: -Shift Reduce Parser is a type of Bottom-Up Parser. It generates the Parse Tree from Leaves to the Root. In Shift Reduce Parser, the input string will be reduced to the starting symbol. This reduction can be produced by handling the rightmost derivation in reverse, i.e., from starting symbol to the input string.

Detailed explanation-2: -A shift-reduce parser is a class of efficient, table-driven bottom-up parsing methods for computer languages and other notations formally defined by a grammar. The parsing methods most commonly used for parsing programming languages, LR parsing and its variations, are shift-reduce methods.

Detailed explanation-3: -BOTTOM-UP PARSING constructs a parse tree for an input string beginning at the leaves and working up towards the root. To do so, bottom-up parsing tries to find a rightmost derivation of a given string backwards.

Detailed explanation-4: -LR parsing is also a category of Bottom-up parsing. It is generally used to parse the class of grammars whose size is large. In the LR parsing, “L” stands for scanning of the input left-to-right, and “R” stands for constructing a rightmost derivation in a reverse way.

Detailed explanation-5: -Shift reduce parsing is a process of reducing a string to the start symbol of a grammar. Shift reduce parsing uses a stack to hold the grammar and an input tape to hold the string.

There is 1 question to complete.