All Exams Test series for 1 year @ ₹349 only
Question

Match the LIST-I with LIST-II
LIST-I InputLIST-II Compiler Phase
A. Syntax TreeI. Code Generator
B. Character StreamII. Syntax Analyzer
C. Intermediate RepresentationIII. Semantic Analyzer
D. Token StreamIV. Lexical Analyzer

The correct answer is
A-III, B-IV, C-I, D-II

Matching Compiler Concepts to Phases

This question requires matching concepts from LIST-I with the corresponding phases of a compiler listed in LIST-II. The correct matching is determined by understanding the role of each phase.

A. Syntax Tree matched with III. Semantic Analyzer

The Syntax Tree represents the grammatical structure of the code. The Semantic Analyzer processes this tree to check for type consistency, variable declarations, and other meaning-related rules.

B. Character Stream matched with IV. Lexical Analyzer

The Character Stream is the raw sequence of input characters from the source code. The Lexical Analyzer (also known as the scanner) reads this stream to identify and group characters into meaningful tokens.

C. Intermediate Representation matched with I. Code Generator

Intermediate Representation (IR) is a representation of the source code that is machine-independent but closer to machine code than the source. The Code Generator phase takes this IR as input to produce the final target machine code.

D. Token Stream matched with II. Syntax Analyzer

The Token Stream is the sequence of tokens produced by the Lexical Analyzer. The Syntax Analyzer (also known as the parser) takes this stream as input to verify the grammatical structure according to the language's rules, often building a syntax tree.

Final Matching

Based on the analysis, the correct matches are:

  • A -> III (Syntax Tree -> Semantic Analyzer)
  • B -> IV (Character Stream -> Lexical Analyzer)
  • C -> I (Intermediate Representation -> Code Generator)
  • D -> II (Token Stream -> Syntax Analyzer)

This corresponds to the option A-III, B-IV, C-I, D-II.

Was this answer helpful?

Important Questions from Code Optimization

  1. Which of the following is the correct High level code for the given TAC in the passage
  2. What are the various LEADERS (leading statements) for the TAC given in the passage?
  3. Which of the followings is the correct Flow graph for the TAC given in the passage?
  4. Which of the following is the Optimized version for the given TAC in the passage
  5. Consider the control flow graph shown in the figure.
     


    Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B4 and B5?
    Note: All the variables are integers.

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App