GATEverse Practice, past papers & mock tests
GATE 2021 · Set-1
Compiler DesignParsing TechniqueshardMCQ2 marks

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:

GRAMMAR RULES
PD* E*
Dint ID {record that ID.lexeme is of type int}
Dbool ID {record that ID.lexeme is of type bool}
EE1 + E2 {check that E1.type = E2.type = int; set E.type := int}
E!E1 {check that E1.type = bool; set E.type := bool}
EID {set E.type := int} With respect to the above grammar, which one of the following choices is correct?
Save your progress

Related Compiler Design PYQs