GATE CSE · 2026 · CS
Question 53: Compiler Design
Give it a try, then reveal the answer to check your work.
Question 53
CSMSQ2 marksNeeds review
Consider the following two syntax-directed definitions SD1 and SD2 for type declarations.
SD1
Grammar (G1) | Semantic Rules
D → T V: D.type = T.type; V.type = T.type
T → int: T.type = int
T → float: T.type = float
V → V₁ id: V₁.type = V.type; put(id.entry, V.type)
V → id: put(id.entry, V.type)
SD2
Grammar (G2) | Semantic Rules
D → D₁ id: D.type = D₁.type; put(id.entry, D₁.type)
D → T id: D.type = T.type; put(id.entry, T.type)
T → int: T.type = int
T → float: T.type = float
D is the start symbol, and int, float and id are the terminals. The non-terminal V₁ is the same as V and the non-terminal D₁ is the same as D. Here, the subscript is used to differentiate the grammar symbol on the two sides of a production. The function put updates the symbol table with the type information for an identifier.
Let P and Q be the languages specified by grammars G1 and G2, respectively.
Which of the following statements is/are true?
Your answerSelect all correct options. You can choose more than one.
Log in to check the answer
You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answerEXPLORE & PRACTISE
Paper and topic context
See where this question comes from and choose what to practise next.
2026CS
GATE CSE 2026 · Paper 1
Computer Science and Information Technology · Original paper archive
- Section
- Computer Science and Information Technology
- Question type
- Multiple select (MSQ)
- Marks
- 2 marks
Practise related topics
Explore more previous year questions using this question’s imported topic tags.
computer science
GATE CSE previous year questions
information technology
GATE CSE previous year questions
computing
GATE CSE previous year questions
compiler design
GATE CSE previous year questions
Comments
Ask a question, share your approach, or help someone understand.
Log in to view the discussion
You’re not logged in. Log in or create an account to see discussions and add comments.