COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following option is not a function of the shift-reduce parser?
A
Reduce
B
Accept
C
Go
D
Shift
Explanation: 

Detailed explanation-1: -Explanation : The shift-reduce parser contains only shift, reduce, error and accept action. That’s why Go is not a function of the shift-reduce parser.

Detailed explanation-2: -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-3: -In shift-reduce parsing, the parse tree is constructed from leaves(bottom) to the root(up). A more general form of shift reduce parser is LR parser.

Detailed explanation-4: -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-5: -Explanation: Bottom-up parsing method is also known as shift-reduce parsing.

There is 1 question to complete.