Ans 3
Ans 3
Here we discuss two pass and single pass assembly schemes in this
section:
Two pass translation
Two pass translation of an assembly language program can handle forward references
easily. LC processing is performed in the first pass and symbols defined in the program
are entered into the symbol table. The second pass synthesizes the target form using
the address information found in the symbol table. In effect, the first pass performs
analysis of the source program while the second pass performs synthesis of the target
program. The first pass constructs an intermediate representation (IR) of the source
program for use by the second pass. This representation consists of two main
components–data structures, e.g. the symbol table, and a processed form of the source
program. The latter component is called intermediate code (IC).
Single pass translation
LC processing and construction of the symbol table proceed as in two pass translation.
The problem of forward references is tackled using a process called backpatch-ing. The
operand field of an instruction containing a forward reference is left blank initially. The
address of the forward referenced symbol is put into this field when its definition is
encountered.
Pass I:
3. Perform LC processing.