Q43
MSQ2 marksConsider the following two syntax-directed definitions and for type declarations. SDD1 Grammar (G1)Semantic Rules D \rightarrow T\ V$$D.type = T.type T \rightarrow \text{int}$$T.type = \text{int} T \rightarrow \text{float}$$T.type = \text{float} V \rightarrow V_1\ \text{id}$$V_1.type = V.type V \rightarrow \text{id}$$\text{put(id.entry, V.type)} SDD2 Grammar (G2)Semantic Rules D \rightarrow D_1\ \text{id}$$D.type = D_1.type \text{put(id.entry, D_1.type)} D \rightarrow T\ \text{id}$$D.type = T.type T \rightarrow \text{int}$$T.type = \text{int} T \rightarrow \text{float}$$T.type = \text{float} is the start symbol, and int, float and id are the three terminals. The non-terminal is the same as and the non-terminal is the same as . Here, the subscript is used to differentiate the grammar symbols on the two sides of a production. The function put updates the symbol table with the type information for an identifier. Let and be the languages specified by grammars and , respectively. Which of the following statements is/are true?
Loading…