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

Discussion

Annotating the syntax tree with type information is the work of

  • A.the code generator once the target machine has been fixed
  • B.the lexical analyser as each identifier is first encountered
  • C.semantic analysis
  • D.the parser as it constructs the tree from the token stream

Answer: C

Semantic analysis walks the tree, consults the symbol table for the types of names, computes the type of each expression and records it on the node. The annotated tree is then passed on to intermediate code generation.

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

Post your comment

Please log in or register to post a comment.