GATE Computer Science (CS) 2021 Shift 1 Solved Paper

© examsiri.com
Question : 36 of 65
 
Marks: +1, -0
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 â†’ D* E*
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?
Go to Question: