GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 17(b)

Two-pass assembler tables

Compiler Design · Compiler Phases, Linking & Loading · Full GATE CSE 1994 paper

GATE 1994, Q17(b) Descriptive
Report issue

Compiler Phases, Linking & Loading

Question 17(b), GATE 1994: State true or false with reason: A two-pass assembler uses its machine opcode table in the first pass of assembly.
Question 17(b), GATE 1994: State true or false with reason: A two-pass assembler uses its machine opcode table in the first pass of assembly.
Tap to enlarge
Answer & solution

Answer: True for the conventional two-pass assembler. (no official key was published)

1. Pass one assigns addresses and builds the symbol table. To advance the location counter correctly, it must recognize instructions and determine their lengths.

2. The machine opcode table supplies instruction classification and length information, so it is consulted before final code generation in pass two.

3. Using the table does not mean final object code or unresolved operand addresses must already be emitted during pass one.

Original paper, page 6