Professional Documents
Culture Documents
long profit;
LP Pass:
- A LP pass is the processing of every statement in a source program , or its
equivalent representation, to perform a language processing function
(a set of LP functions).
- Process a program in 2 passes:
Pass I : Perform analysis of the source program and note relevant information.
Pass II : Perform synthesis of target program.
Intermediate Representation:
- IR
Analysis phase :
Pass I:
1. Separate the symbol, mnemonic opcode and operand fields.
2. Build the symbol table.
3. Perform LC processing.
4. Construct intermediate representation.
Pass II: START 200 LC
Synthesize the target program. MOVER BREG=‘4’ 200
LOOP MOVER AREG N 201
Advanced Assembler Directives : ADD BREG=‘2’ 202
1) ORIGIN ORIGIN LOOP + 5
ORIGIN <address spec>
NEXT BC ANY, LOOP 206
LTORG 207
1) LTORG ORIGIN NEXT + 3
N DC 5 209
2) EQU END 210
Basic format is : <symbol> EQU <address spec>
(Using EQU directive we are actually Literal Address
associating LHS label with the RHS =‘4’ 207
address, i.e “X is set to the address of Y”)
=‘2’ 208
Pass I Initializer
Modify LC
Read next
instr.
yes Process
END
IS Literals Pass II
Instr. yes
Insert label in
ORIGIN Has
IC label? symbol table
No
DL
Types of
instruction
LTORG
Data structure in pass I
1) Assembly program
2) Machine code opcode table (MOT)
3) Symbol table
4) Literal table
5) Pool table
Pass I
IC
Data structure
Pass II
Furnished code
- Hence the grammar must be written such that reduction of * precedes the
reduction of + in a + b * c;