Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it:
View worked solution
Answer: C
To find the correct matching, let us analyze the input processed by each phase of a standard compiler:
- Q. Character stream is the raw input program. It is processed by the iv. Lexical analyser to produce a stream of tokens. Thus, Q → iv.
- S. Token stream is the output of the lexical analyzer and serves as the input to the ii. Syntax analyser (parser) to construct a parse tree or syntax tree. Thus, S → ii.
- P. Syntax tree is the input to the iii. Semantic analyser, which performs type checking and other static semantic checks. Thus, P → iii.
- R. Intermediate representation (IR) is processed by the i. Code generator to produce the target machine code. Thus, R → i.
Combining these matches:
This corresponds to Option C.
Free practice · Your answers on this page are not saved.
