The Gateway to Computer Science Excellence
+17 votes
3.9k views

A simple two-pass assembler does the following in the first pass:

  1. It allocates space for the literals.

  2. It computes the total length of the program.

  3. It builds the symbol table for the symbols and their values.

  4. It generates code for all the load and store register instructions.

  5. None of the above.

in Compiler Design by Veteran (52.2k points) | 3.9k views

3 Answers

+25 votes
Best answer
by Veteran (424k points)
edited by
0
Sir this link is not opening so pls provide another good link of answer.
+1
Added..
0
in option c wht about unresolved symboles
0

It allocates space for the literals.

 As per the given pdf in pass 1 each line of the AL is given some address and literals are stored in symbol table. In pass 2 OPTAB and SYMTAB works in collaboration to generate mc code. B and C options are fine. I am not getting why A?

0

@jatin khachane 1 plz help with option a.

+16 votes

A,B,C are correct 

scan the code twice. The first time, just count how long the machine code instructions will be, just to find out the addresses of all the labels. Also, create a table that has a list of all the addresses and where they will be in the program. This table is known as the symbol table. On the second scan, generate the machine code, and use the symbol table to determine how far away jump labels are, and to generate the most efficient instruction.

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

by Active (2.8k points)
0 votes
a,b,c
by (11 points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,647 questions
56,476 answers
195,396 comments
100,383 users