Question
Which of the following statements is/are FALSE?
Official answer and solution
- Official answer
- B and D
- From
- Official GATE 2024 answer key
Solution
Check standard properties of attribute grammars, S-attributed definitions, and L-attributed definitions.
Note that the question asks which statements are FALSE:
- (A) is TRUE: By definition, an attribute grammar is an SDD without side effects in its semantic rules.
- (B) is FALSE: In any L-attributed SDD, an inherited attribute of a symbol on the RHS depends only on the inherited attributes of the parent and the attributes of symbols strictly to its left on the RHS. Therefore, the attributes of any L-attributed SDD can always be evaluated in a depth-first (left-to-right) traversal of the parse tree.
- (C) is TRUE: S-attributed definitions (containing only synthesized attributes) can always be evaluated on the fly by a bottom-up LR parser during reduction steps.
- (D) is FALSE: Evaluating inherited attributes in an L-attributed definition during bottom-up LR(1) parsing requires introducing marker nonterminals, which can introduce shift/reduce or reduce/reduce conflicts so that the modified grammar is no longer LR(1) (unlike LL(1) grammars, for which every L-attributed SDD can be evaluated bottom-up).
Therefore, (B) and (D) are the FALSE statements.
Final answer
Options (B), (D)
Common trap
Selecting the TRUE statements (A) and (C) instead of the FALSE statements.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2024 Computer Science and Information Technology - Set 2 (CS2)
- Question
- 29 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.