Design of a two pass assembler

9,268 views 14 slides Sep 08, 2019
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

presentation on design of a 2 pass assembler, and variant I and variant II in the subject of systems programming. especially helpful to GTU students, CSE and IT engineers


Slide Content

SYSTEM PROGRAMMING ALA Variants of Assemblers, Design of two pass assembler Dhananjaysinh Jhala 170410107027 TY CE 1 Batch B

Design of 2 pass assembler Tasks performed by the passes of a two pass assembler are: Pass 1: Separate the symbol, mnemonic opcode and operand fields Build the symbol table Perform LC processing Construct intermediate representation Pass 2: Synthesize the target program

Design of 2 pass assembler Pass 1 uses the given data structures: OPTAB - table of mnemonic opcodes, class (IS,DL,AD) and mnemonic info SYMTAB - symbol table LITTAB - table of literals used in the program POOLTAB - table of information concerning literal pools

PROGRAM EXAMPLE

ALGORITHM FOR pass 1

INTERMEDIATE CODE FORMS IC Consists of a sequence of IC units having 3 fields : Variant forms of intermediate codes, specifically the operand and address fields are used. Information in mnemonic code field has the same representation in all variants.

VARIANT 1 First operand is represented by a single digit number which is either code used for register or condition code itself. Second operand is a memory operand represented by a pair of the form (operand class, code) where operand class is C,S or L(constant, symbol or literal).

Note that for variant 1, 2 kinds of entries exist in the symbol table at any time : (for defined symbol) and (for forward references) i.e. We need to enter A in the symbol table, suppose at entry number 'n', but at this point address and length fields of A are not known.

VARIANT 2 It differs from variant one because here the operand field of intermediate code maybe in the processed form or in the source form itself. For an AD/DL, operand has to be in the processes form to support LC processing. Symbolic references in the operand field of intermediate statements are put in the source form itself.