search
Log In
19 votes
6.7k 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 6.7k views

3 Answers

26 votes
 
Best answer

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.

19 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

0
Completely understandable from this link,, thank u :)
0 votes
a,b,c

Related questions

10 votes
3 answers
1
2.8k views
A part of the system software which under all circumstances must reside in the main memory is: text editor assembler linker loader none of the above
asked Sep 30, 2014 in Compiler Design Kathleen 2.8k views
2 votes
4 answers
2
557 views
In a two-pass assembler, resolution of subroutine calls and inclusion of labels in the symbol table is done during second pass first pass and second pass respectively second pass and first pass respectively first pass
asked Jan 13 in Compiler Design Satbir 557 views
13 votes
1 answer
3
1.9k views
Mention the pass number for each of the following activities that occur in a two pass assembler: object code generation literals added to literal table listing printed address resolution of local symbols
asked Sep 13, 2014 in Compiler Design Kathleen 1.9k views
27 votes
6 answers
4
3.3k views
$\displaystyle \sum_{1\leq k\leq n} O(n)$, where $O(n)$ stands for order $n$ is: $O(n)$ $O(n^2)$ $O(n^3)$ $O(3n^2)$ $O(1.5n^2)$
asked Sep 30, 2014 in Algorithms Kathleen 3.3k views
...