Machine-translated by Google. Questions are authored in English.
Top

Discussion

Type checking is normally done during ....................... .

  • A.Lexical Analysis
  • B.Code Generation
  • C.Syntax Analysis
  • D.Syntax Directed Translation

Answer: D

Type checking is normally done during Syntax Directed Translation.

Type checking is part of semantic analysis. In the Aho, Lam, Sethi and Ullman treatment, it is implemented as a syntax-directed translation: semantic rules attached to the grammar productions compute the types of expressions from the types of their parts and report mismatches as the parse tree is built.

Lexical analysis only groups characters into tokens and knows nothing about types. Syntax analysis checks that the token sequence fits the grammar, which says nothing about whether the operand types agree. Code generation comes after the checks and uses type information that is already established.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.