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

Discussion

Match each phase with what it produces.
List I
A. lexical analysis
B. syntax analysis
C. semantic analysis
D. intermediate code generation
List II
1. an annotated syntax tree
2. a stream of tokens
3. three address code
4. a parse or syntax tree

  • A.A-2, B-4, C-3, D-1
  • B.A-3, B-1, C-4, D-2
  • C.A-2, B-4, C-1, D-3
  • D.A-4, B-2, C-1, D-3

Answer: C

Correct answer: A-2, B-4, C-1, D-3

Each phase transforms its predecessor's output. Lexical analysis produces a stream of tokens; syntax analysis groups them into a parse or syntax tree.

Semantic analysis decorates that tree with types, scopes and coercions, giving an annotated syntax tree. Intermediate code generation flattens it into three-address code, a machine-independent form on which optimisation can work. Reading the outputs as a sequence - characters, tokens, tree, annotated tree, three-address code - settles the whole matching.

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

Post your comment

Please log in or register to post a comment.