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

Discussion

Intermediate code generation is placed after semantic analysis because

  • A.optimisation must be performed before types are checked
  • B.the types of expressions must be known before code can be emitted
  • C.the parser cannot complete until code has been generated
  • D.the symbol table is not created until the code generation begins

Answer: B

Which instruction to emit depends on the operand types, and any coercions must already have been inserted. Generating code first would mean regenerating it once the types became known. Coercions in particular change which instruction must be emitted.

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

Post your comment

Please log in or register to post a comment.