All Exams Test series for 1 year @ ₹349 only
Question

Shift-Reduce parsers perform the following :

This question was previously asked in
UGC NET 2014 Paper 1 Question Paper (28-Dec-2014)
The correct answer is

Shift step that advances in the input stream by one symbol and Reduce step that applies a completed grammar rule to some recent parse trees, joining them together as one tree with a new root symbol.

A shift-reduce parser is a bottom-up parser. It keeps a stack of partially built parse trees and repeatedly chooses between two actions: shift and reduce.

Shift: the next input token is moved onto the stack, so the parser advances in the input stream by exactly one symbol each time it shifts. Shifting K symbols at once (K = 2 or K > 1) is not how the action is defined, and a shift that does not advance the input would never consume the string.

Reduce: when the top of the stack matches the right-hand side of a production (a completed grammar rule), those recent parse trees are popped and joined under a new node labelled with the left-hand side nonterminal, i.e. one tree with a new root symbol.

Only the description with a one-symbol shift and a reduce that joins recent parse trees under a new root matches both actions.

Hence, the answer is Shift step that advances in the input stream by one symbol and Reduce step that applies a completed grammar rule to some recent parse trees, joining them together as one tree with a new root symbol..

Was this answer helpful?

Similar Questions

  1. Which phase of compiler generates stream of atoms ?

  2. Match List I with List II

    List IList II
    A. Initial Configuration of stack and input in LL Parsing process.I. \(\$\) w\(\$\)
    B. Final Configuration of stack and input in LL Parsing processII. \(\$\) \(\$\)
    C. Initial Configuration of stack and input in LR Parsing processIII. \(\$\)S w\(\$\)
    D. Final Configuration of stack and input in LR Parsing processIV. \(\$\)S \(\$\)

    Choose the correct answer from the options given below:

  3. While processing a string by an LR parser, the reading of the given string by the parser is--------------.

  4. Arrange the following stages of parsing in the correct order as they typically occur in the compilation process.

    (A) Lexical Analysis

    (B) Sematic Analysis

    (C) Syntax Analysis

    (D) Intermediate Code Generation

    (E) Code Optimization

    Choose the correct answer from the options given below :


Important Questions from Syntax Analyzer

  1. Which of the following not correct according to input to output, the compiler phase that is processes by it?

    Phases of CompilerInputOutput
    ALexical AnalyzerCharacter streamToken stream
    BSyntax AnalyzerToken streamSyntax tree
    CSemantic AnalyzerSyntax treeSyntax tree
    DIntermediate Code GeneratorSyntax treeTarget-machine code
  2. Match the description of several parts of a classic optimizing compiler in List - I, with the names of those parts in List - II:

    List - I

    List - II

    A. A part of a compiler that is responsible for recognizing

    1. Optimizer syntax

    B. A part of a compiler that takes as input a stream of characters and produces as output a stream of words along with their associated syntactic categories.

    2. Semantic Analysis

    C. A part of a compiler that understands the meanings of variable names and other symbols and checks that they are used in ways consistent with their definitions.

    3. Parser

    D. An IR-to-IR transformer that tries to improve the IR program in some way (Intermediate Representation).

    4. Scanner

  3. Which phase of compiler generates stream of atoms ?

  4. Match List I with List II

    List IList II
    A. Initial Configuration of stack and input in LL Parsing process.I. \(\$\) w\(\$\)
    B. Final Configuration of stack and input in LL Parsing processII. \(\$\) \(\$\)
    C. Initial Configuration of stack and input in LR Parsing processIII. \(\$\)S w\(\$\)
    D. Final Configuration of stack and input in LR Parsing processIV. \(\$\)S \(\$\)

    Choose the correct answer from the options given below:

  5. While processing a string by an LR parser, the reading of the given string by the parser is--------------.

Need Expert Advice?
Upcoming Exams
CTET
December 12, 2026
CBSE UGC NET
December 14, 2026
CSIR UGC NET
December 19, 2026
Test Series
UGC NET img
Teaching
UGC NET (Paper 2) 2026 Mock Test Series
796 Tests 2 Tests Free
219 Attempts
4.4(46)
English
More Questions from UGC NET

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App