GATE / CS ARCHIVE

GATE CSE 1998 / QUESTION 1.27

Where type checking occurs

Compiler Design · Semantic Analysis & Type Checking · Full GATE CSE 1998 paper

GATE 1998, Q1.27 1 mark · MCQ
Report issue

Semantic Analysis & Type Checking

Question 1.27, GATE 1998: Choose lexical analysis, syntax analysis, syntax-directed translation, or code optimization as the normal type-checking mechanism.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Lexical analysis identifies tokens, and parsing checks grammatical structure. Type checking instead propagates and compares semantic attributes: for example, an addition node checks operand types and computes the result type. Syntax-directed definitions or translation rules attach exactly these operations to grammar productions, making C the appropriate option. Optimization can use type information but is not the normal first stage responsible for establishing semantic type compatibility.

Original paper, page 3