Computer Sciences > GATE 2021 SET-1 > Syntax Directed Translation
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:
P -> DE
D -> int ID {record that ID.lexeme is of type int}
D -> bool ID {record that ID.lexeme is of type bool}
E -> E1 + E2 {check that E1.type = E2.type = int; set E.type:= int}
E ->!E1 {check that E1.type = bool; set E.type:= bool}
E -> ID {set E.type:= int}
With respect to the above grammar, which one of the following choices is correct?
P -> DE
D -> int ID {record that ID.lexeme is of type int}
D -> bool ID {record that ID.lexeme is of type bool}
E -> E1 + E2 {check that E1.type = E2.type = int; set E.type:= int}
E ->!E1 {check that E1.type = bool; set E.type:= bool}
E -> ID {set E.type:= int}
With respect to the above grammar, which one of the following choices is correct?
Correct : b
Similar Questions
Given the following syntax directed translation rules:Rule 1: R→AB {B.i = R.i1; A.i=B.i; R.i=A.i+1;}Rule 2: P→CD {P.i = C.i+D.i; D.i=C.i+2;}Rule 3: Q&...
A palindrome is a word that reads the same forwards and backwards. In a game
of words, a player has the following two plates painted with letters.
From...
Which number does not belong in the series below?
2, 5, 10, 17, 26, 37, 50, 64
Total Unique Visitors
Loading......