in Compiler Design edited by
2,729 views
14 votes

Mention the pass number for each of the following activities that occur in a two pass assembler:

  1. object code generation
  2. literals added to literal table
  3. listing printed
  4. address resolution of local symbols
in Compiler Design edited by
2.7k views

2 Comments

edited by

Exactly same question  - https://gateoverflow.in/2721/gate1996_1-17

Each pass scans the program, the first pass generates the symbol table and the second pass generates the machine code.

http://users.cis.fiu.edu/~downeyt/cop3402/two-pass.htm

2

Tasks performed in 1st pass –

- Assign address to all statements (address resolution)

- Save the values

- Processing of assembler directives 

- Table creation , Adding literals to literal table

- Allocate space for literals

- Compute total length of a program

 

Tasks performed in 2nd pass –

- Generate object oriented code

- Writing/prinitng assembly listing

- Generate code for all load and store instruction 

1

1 Answer

19 votes
 
Best answer
  1. $2$
  2. $1$
  3. $2$
  4. $1$


P.S. : In first pass, symbol table is created and In second pass, machine code is generated. Listing of final machine code is done after $2^{\text{nd}}$ pass only.

edited by

8 Comments

Reference ?
0
Akash, did you find any reference?
0
You can see System Programming book. Or assembler implementation lab exercise..
0

ans should be 2, 1, 2, 1 acrdng to description given in this ques

https://gateoverflow.in/2721/gate1996_1-17

Arjun sir plz check these ques

4
You are correct. Edited.
0
is it in syllabus ?
0
@meghna , Detailed syllabus of gate is not given anywhere and 'assembler' is not mention in gate syllabus..
Parsers and grammar are the important topics from compilers.
3

Related questions