GATE CS 2024 Set 2 | Question 29

Compiler Design › Basics & Lexical · MSQ · 1 mark · Answer: B, D

  1. Question 29Compiler Designmsq1 mark
    Which statements is/are FALSE?
    • A.
      An attribute grammar is an SDD whose semantic-rule functions have no side effects
    • B.
      The attributes in an L-attributed definition cannot always be evaluated in depth-first order
      ✓
    • C.
      Synthesized attributes can be evaluated by a bottom-up parser as the input is parsed
    • D.
      All L-attributed definitions based on an LR(1) grammar can be evaluated using bottom-up parsing
      ✓

    Answer: B, D

    Solution

    Answer: (B) and (D) - (B) is FALSE: L-attributed definitions are specifically designed so that all attributes CAN be evaluated in a single depth-first (left-to-right) traversal. - (D) is FALSE: not every L-attributed SDD on an LR grammar can be evaluated bottom-up (inherited attributes can be problematic); only the S-attributed subset is always bottom-up evaluable. - (A) and (C) are TRUE statements.

More GATE PYQ on Basics & Lexical

All GATE CS Compiler Design PYQ →

Attempt GATE CS 2024 Set 2 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →