Compiler Design

105601
Back to Compiler Design

Module 2: Syntax Analysis (Parser)

  1. Q1a. Which of the following is the most powerful parser? (i) SLR (ii) LALR (iii) Canonical LR (iv) Operator precedence20232m

    Module 2: Syntax Analysis (Parser)

    Which of the following is the most powerful parser?
    (i) SLR
    (ii) LALR
    (iii) Canonical LR
    (iv) Operator precedence

    View this question on its own page →
  2. Q1b. A top down parser generates (i) Rightmost derivation (ii) Rightmost derivation in reverse (iii) Leftmost derivation (iv) Left most derivation in reverse20232m

    Module 2: Syntax Analysis (Parser)

    A top down parser generates
    (i) Rightmost derivation
    (ii) Rightmost derivation in reverse
    (iii) Leftmost derivation
    (iv) Left most derivation in reverse

    View this question on its own page →
  3. Q1e. Handle pruning forms the basis of........ (i) Bottom up parsing (ii) Top down parsing (iii) Predictive parsing (iv) Recursive descent parsing20232m

    Module 2: Syntax Analysis (Parser)

    Handle pruning forms the basis of........
    (i) Bottom up parsing
    (ii) Top down parsing
    (iii) Predictive parsing
    (iv) Recursive descent parsing

    View this question on its own page →
  4. Q1f. Left factoring guarantees (i) Not occurring of backtracking (ii) Cycle free parse tree (iii) Error free target code (iv) Correct LL(1) parsing table20232m

    Module 2: Syntax Analysis (Parser)

    Left factoring guarantees
    (i) Not occurring of backtracking
    (ii) Cycle free parse tree
    (iii) Error free target code
    (iv) Correct LL(1) parsing table

    View this question on its own page →
  5. Q1g. Consider a grammar A \to a S_1 | a S_2. The left factored grammar produced from the grammar is (i) A \to a A', A' \to S_1 | S_2 (ii) A' \to a A, A \to a S_1 | a S_2 (iii) A \to a A', A' \to S_1 | S_2, S_1 \to S_1, S_2 (iv) None of these20232m

    Module 2: Syntax Analysis (Parser)

    Consider a grammar AaS1aS2A \to a S_1 | a S_2. The left factored grammar produced from the grammar is
    (i) AaA,AS1S2A \to a A', A' \to S_1 | S_2
    (ii) AaA,AaS1aS2A' \to a A, A \to a S_1 | a S_2
    (iii) AaA,AS1S2,S1S1,S2A \to a A', A' \to S_1 | S_2, S_1 \to S_1, S_2
    (iv) None of these

    View this question on its own page →
  6. Q1j. For a grammar G, shift reduce (S-R) conflicts are present in LALR(1) parser, if and only if (i) The LAR (1) parser for G has S.R conflicts (ii) The LR(0) parser for G has S.R conflicts (iii) The SLR(1) parser for G has S.R conflicts (iv) The SLR(0) parser for G has S.R conflicts20232m

    Module 2: Syntax Analysis (Parser)

    For a grammar G, shift reduce (S-R) conflicts are present in LALR(1) parser, if and only if
    (i) The LAR (1) parser for G has S.R conflicts
    (ii) The LR(0) parser for G has S.R conflicts
    (iii) The SLR(1) parser for G has S.R conflicts
    (iv) The SLR(0) parser for G has S.R conflicts

    View this question on its own page →
  7. Q3a. What are the advantages of LALR parsing over SLR and CLR methods?20235m

    Module 2: Syntax Analysis (Parser)

    What are the advantages of LALR parsing over SLR and CLR methods?

    View this question on its own page →
  8. Q3b. Write the algorithm to compute FIRST and FOLLOW for a given grammar.20235m

    Module 2: Syntax Analysis (Parser)

    Write the algorithm to compute FIRST and FOLLOW for a given grammar.

    View this question on its own page →
  9. Q3c. What is shift-reduce conflict?20234m

    Module 2: Syntax Analysis (Parser)

    What is shift-reduce conflict?

    View this question on its own page →
  10. Q4b. Find the FIRST an FOLLOW form the following production: S \to aBDh B \to cC C \to bC | \epsilon D \to EF E \to g | \epsilon F \to f | \epsilon20237m

    Module 2: Syntax Analysis (Parser)

    Find the FIRST an FOLLOW form the following production:
    SaBDhS \to aBDh
    BcCB \to cC
    CbCϵC \to bC | \epsilon
    DEFD \to EF
    EgϵE \to g | \epsilon
    FfϵF \to f | \epsilon

    View this question on its own page →
  11. Q5a. Construct the predictive parsing table for the following grammars: S \to AaAb | BbBa A \to \epsilon B \to \epsilon20237m

    Module 2: Syntax Analysis (Parser)

    Construct the predictive parsing table for the following grammars:
    SAaAbBbBaS \to AaAb | BbBa
    AϵA \to \epsilon
    BϵB \to \epsilon

    View this question on its own page →
  12. Q6a. What is handle? Consider the grammar: E \to E + E | E * E | id Find the handles of the right sentential forms of the reduction for the string id + id * id.20235m

    Module 2: Syntax Analysis (Parser)

    What is handle? Consider the grammar:
    EE+EEEidE \to E + E | E * E | id
    Find the handles of the right sentential forms of the reduction for the string id+ididid + id * id.

    View this question on its own page →
  13. Q6b. When a grammar is called ambiguous? Is there any technique to remove ambiguity? Justify whether the grammar is ambiguous or not? A \to AA | (A) | a20234m

    Module 2: Syntax Analysis (Parser)

    When a grammar is called ambiguous? Is there any technique to remove ambiguity? Justify whether the grammar is ambiguous or not?
    AAA(A)aA \to AA | (A) | a

    View this question on its own page →
  14. Q6c. Discuss about operator precedence parser.20235m

    Module 2: Syntax Analysis (Parser)

    Discuss about operator precedence parser.

    View this question on its own page →
  15. Q7b. Consider the following grammar: E \to E + T | T T \to T * F | F F \to td Draw a SLR state transition diagram for the above grammar. Also draw the SLR parse table.20237m

    Module 2: Syntax Analysis (Parser)

    Consider the following grammar:
    EE+TTE \to E + T | T
    TTFFT \to T * F | F
    FtdF \to td
    Draw a SLR state transition diagram for the above grammar. Also draw the SLR parse table.

    View this question on its own page →
  16. Q8a. Consider the following grammar: S \to CC C \to cC | d Find the LR(1) set of items.20235m

    Module 2: Syntax Analysis (Parser)

    Consider the following grammar:
    SCCS \to CC
    CcCdC \to cC | d
    Find the LR(1) set of items.

    View this question on its own page →