SlideShare a Scribd company logo
System Programming
Walchand Institute of Technology
Aim:
Design & implementation of
Theory:
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
second pass performs synthesis of the target program. The first pass constructs an
intermediate representation of the source program for use by the second pass as
shown in figure. This repre
structures, e.g. the symbol table, and a processed form of the source program. The
latter component is called intermediate code.
Figure: Overview of two pass assembly
Tasks performed by the passes of a two
• Pass I:
1. Separate the symbol, mnemonic, opcode and operand.
Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur
HANDOUT#07
Design & implementation of pass 2 of two pass assembler
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
the address information found in the symbol table. In effect, the
pass performs synthesis of the target program. The first pass constructs an
intermediate representation of the source program for use by the second pass as
shown in figure. This representation consists of two main components
structures, e.g. the symbol table, and a processed form of the source program. The
latter component is called intermediate code.
Figure: Overview of two pass assembly
Tasks performed by the passes of a two pass assembler are as follows:
Separate the symbol, mnemonic, opcode and operand.
Sunita M. Dol, CSE Dept
Page 1
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
the address information found in the symbol table. In effect, the
pass performs synthesis of the target program. The first pass constructs an
intermediate representation of the source program for use by the second pass as
sentation consists of two main components—data
structures, e.g. the symbol table, and a processed form of the source program. The
pass assembler are as follows:
Separate the symbol, mnemonic, opcode and operand.
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 2
2. Build Symbol Table.
3. Perform LC Processing.
4. Construct Intermediate Representation.
• Pass II:
1. Process IR to synthesize the target program.
Pass I performs analysis of the source program and the synthesis of the
intermediate representation while Pass II processes the intermediate representation
to synthesize the target program.
Following algorithm is the algorithm for assembler Pass II
Algorithm for Pass II
1. code_area_address := address of code area
pooltable_ptr := 1
location_counter := 0
2. While next statement is not an end statement then
a. Clear machine_code_buffer
b. If an LTORG statement then
i. Process literals in LITTAB[POOLTAB[pooltable_ptr]]……..
LITTAB[POOLTAB[pooltable_ptr + 1] -1 similarly
processing of constants in a DC statement i.e. assemble the
literals in machine_code_buffer.
ii. size := size of memory area required for literals
iii. pooltable_ptr := polltable_ptr +1
c. if a START or ORIGIN statement then
i. location_counter := value specified in operand field
ii. size := 0
d. If a declaration statement then
i. If a DC statement then
Assemble the constant in machine_code_buffer
ii. size := size of memory area required by DC or DS
e. If an imperative statement then
System Programming
Walchand Institute of Technology
i. Get the
ii. Assemble instruction in machine_code_buffer
iii. size := size of instruction
f. If size <> 0 then
i. Move the contents of machine_code_buffer to the address
code_area_address + location_counter
ii. location_counter :=
3. Processing end statement
a. Perform steps 2(b) and 2(f)
b. Write code_area into output file
Figure: Example of converting source program to machine language
Input:
0 (AD, 01) (C, 200)
Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur
Get the operand address from SYMTAB or LITTAB
Assemble instruction in machine_code_buffer
size := size of instruction
If size <> 0 then
Move the contents of machine_code_buffer to the address
code_area_address + location_counter
location_counter := location_counter +size
Processing end statement
Perform steps 2(b) and 2(f)
Write code_area into output file
Figure: Example of converting source program to machine language
(AD, 01) (C, 200)
Sunita M. Dol, CSE Dept
Page 3
operand address from SYMTAB or LITTAB
Assemble instruction in machine_code_buffer
Move the contents of machine_code_buffer to the address
location_counter +size
Figure: Example of converting source program to machine language
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 4
200 (IS, 04) (1) (L, 00)
201 (IS, 05) (1) (S, 00)
202 (IS, 04) (1) (S, 00)
203 (IS, 04) (3) (S, 02)
204 (IS, 01) (3) (L, 01)
205 (IS, 07) (6) (S, 03)
206 (AD, 05)
(L, 00)
(L, 01)
208 (IS, 02) (1) (L, 02)
209 (IS, 07) (1) (S, 04)
210 (IS, 00)
210 (AD, 03) (S, 01) + (C, 2)
204 (IS, 03) (3) (S, 02)
205 (AD, 03) (S, 05) + (C, 1)
211 (DL, 02) (C, 1)
212 (AD, 04) (S, 01)
212 (DL, 02) (C, 2)
214 (AD, 02)
(L, 02)
215
Output:
Intermediate Representation
0 (AD, 01) (C, 200)
200 (IS, 04) (1) (L, 00)
201 (IS, 05) (1) (S, 00)
202 (IS, 04) (1) (S, 00)
203 (IS, 04) (3) (S, 02)
204 (IS, 01) (3) (L, 01)
205 (IS, 07) (6) (S, 03)
206 (AD, 05)
(L, 00)
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 5
(L, 01)
208 (IS, 02) (1) (L, 02)
209 (IS, 07) (1) (S, 04)
210 (IS, 00)
210 (AD, 03) (S, 01) + (C, 2)
204 (IS, 03) (3) (S, 02)
205 (AD, 03) (S, 05) + (C, 1)
211 (DL, 02) (C, 1)
212 (AD, 04) (S, 01)
212 (DL, 02) (C, 2)
214 (AD, 02)
(L, 02)
215
The target code
200) 04 1 206
201) 05 1 211
202) 04 1 211
203) 04 3 212
204) 01 3 207
205) 07 6 208
206) 00 0 005
207) 00 0 001
208) 02 1 214
209) 07 1 202
210) 00 0 000
204) 03 3 212
211)
212)
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 6
214) 00 0 001
Conclusion:
The second pass or Pass-II synthesizes the target form using the address
information found in the symbol table.
The second pass performs synthesis of the target program.
Pass I performs analysis of the source program and the synthesis of the
intermediate representation while Pass II processes the intermediate
representation to synthesize the target program.
Thus the Pass-II of two pass assembler is implemented in C-language

More Related Content

What's hot

Handout#10
Handout#10Handout#10
Handout#10
Sunita Milind Dol
 
Handout#03
Handout#03Handout#03
Handout#03
Sunita Milind Dol
 
Handout#12
Handout#12Handout#12
Handout#12
Sunita Milind Dol
 
Handout#09
Handout#09Handout#09
Handout#09
Sunita Milind Dol
 
Assignment4
Assignment4Assignment4
Assignment4
Sunita Milind Dol
 
Handout#01
Handout#01Handout#01
Handout#01
Sunita Milind Dol
 
Chapter2
Chapter2Chapter2
Chapter2
Anees999
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
ArthyR3
 
C notes
C notesC notes
C notes
Raunak Sodhi
 
Chap02
Chap02Chap02
Chap02
Terry Yoast
 
Introduction of C++ By Pawan Thakur
Introduction of C++ By Pawan ThakurIntroduction of C++ By Pawan Thakur
Introduction of C++ By Pawan Thakur
Govt. P.G. College Dharamshala
 
C LANGUAGE NOTES
C LANGUAGE NOTESC LANGUAGE NOTES
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse students
Abdur Rahim
 
Uniti classnotes
Uniti classnotesUniti classnotes
Uniti classnotes
Sowri Rajan
 
Solutions manual for c++ programming from problem analysis to program design ...
Solutions manual for c++ programming from problem analysis to program design ...Solutions manual for c++ programming from problem analysis to program design ...
Solutions manual for c++ programming from problem analysis to program design ...
Warren0989
 
Programming in c
Programming in cProgramming in c
Programming in c
ankitjain851
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
Malikireddy Bramhananda Reddy
 
C language
C languageC language
C language
spatidar0
 
best notes in c language
best notes in c languagebest notes in c language
best notes in c language
India
 
Operators and Expressions in C#
Operators and Expressions in C#Operators and Expressions in C#
Operators and Expressions in C#
Prasanna Kumar SM
 

What's hot (20)

Handout#10
Handout#10Handout#10
Handout#10
 
Handout#03
Handout#03Handout#03
Handout#03
 
Handout#12
Handout#12Handout#12
Handout#12
 
Handout#09
Handout#09Handout#09
Handout#09
 
Assignment4
Assignment4Assignment4
Assignment4
 
Handout#01
Handout#01Handout#01
Handout#01
 
Chapter2
Chapter2Chapter2
Chapter2
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
 
C notes
C notesC notes
C notes
 
Chap02
Chap02Chap02
Chap02
 
Introduction of C++ By Pawan Thakur
Introduction of C++ By Pawan ThakurIntroduction of C++ By Pawan Thakur
Introduction of C++ By Pawan Thakur
 
C LANGUAGE NOTES
C LANGUAGE NOTESC LANGUAGE NOTES
C LANGUAGE NOTES
 
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse students
 
Uniti classnotes
Uniti classnotesUniti classnotes
Uniti classnotes
 
Solutions manual for c++ programming from problem analysis to program design ...
Solutions manual for c++ programming from problem analysis to program design ...Solutions manual for c++ programming from problem analysis to program design ...
Solutions manual for c++ programming from problem analysis to program design ...
 
Programming in c
Programming in cProgramming in c
Programming in c
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
 
C language
C languageC language
C language
 
best notes in c language
best notes in c languagebest notes in c language
best notes in c language
 
Operators and Expressions in C#
Operators and Expressions in C#Operators and Expressions in C#
Operators and Expressions in C#
 

Similar to Handout#07

assembler-ppt.pdf
assembler-ppt.pdfassembler-ppt.pdf
assembler-ppt.pdf
47RahulRAjpurohit
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
First pass of assembler
First pass of assemblerFirst pass of assembler
First pass of assembler
Hemant Chetwani
 
Assembler
AssemblerAssembler
Assembler
SheetalAwate2
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical file
Ankit Dixit
 
Compiler gate question key
Compiler gate question keyCompiler gate question key
Compiler gate question key
ArthyR3
 
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed controlB.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
Rai University
 
Assembler
AssemblerAssembler
Assembler
Maha Lakshmi
 
Assembler
AssemblerAssembler
Assembler
Maha Lakshmi
 
The process of programming
 The process of programming The process of programming
The process of programming
Kopi Maheswaran
 
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed controlBca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Rai University
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
desta_gebre
 
loaders-and-linkers.pdfhhhhhccftyghgfggy
loaders-and-linkers.pdfhhhhhccftyghgfggyloaders-and-linkers.pdfhhhhhccftyghgfggy
loaders-and-linkers.pdfhhhhhccftyghgfggy
rahulyadav957181
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
Dr. Jaydeep Patil
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
kazi_aihtesham
 
basic computer programming and micro programmed control
basic computer programming and micro programmed controlbasic computer programming and micro programmed control
basic computer programming and micro programmed control
Rai University
 
Mca i-u-3-basic computer programming and micro programmed control
Mca i-u-3-basic computer programming and micro programmed controlMca i-u-3-basic computer programming and micro programmed control
Mca i-u-3-basic computer programming and micro programmed control
Rai University
 
Assembler - System Programming
Assembler - System ProgrammingAssembler - System Programming
Assembler - System Programming
Radhika Talaviya
 
Assembler
AssemblerAssembler
Assembler
Sonam Sharma
 
assembler_full_slides.ppt
assembler_full_slides.pptassembler_full_slides.ppt
assembler_full_slides.ppt
Ashwini864432
 

Similar to Handout#07 (20)

assembler-ppt.pdf
assembler-ppt.pdfassembler-ppt.pdf
assembler-ppt.pdf
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programming
 
First pass of assembler
First pass of assemblerFirst pass of assembler
First pass of assembler
 
Assembler
AssemblerAssembler
Assembler
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical file
 
Compiler gate question key
Compiler gate question keyCompiler gate question key
Compiler gate question key
 
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed controlB.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
 
Assembler
AssemblerAssembler
Assembler
 
Assembler
AssemblerAssembler
Assembler
 
The process of programming
 The process of programming The process of programming
The process of programming
 
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed controlBca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 
loaders-and-linkers.pdfhhhhhccftyghgfggy
loaders-and-linkers.pdfhhhhhccftyghgfggyloaders-and-linkers.pdfhhhhhccftyghgfggy
loaders-and-linkers.pdfhhhhhccftyghgfggy
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 
basic computer programming and micro programmed control
basic computer programming and micro programmed controlbasic computer programming and micro programmed control
basic computer programming and micro programmed control
 
Mca i-u-3-basic computer programming and micro programmed control
Mca i-u-3-basic computer programming and micro programmed controlMca i-u-3-basic computer programming and micro programmed control
Mca i-u-3-basic computer programming and micro programmed control
 
Assembler - System Programming
Assembler - System ProgrammingAssembler - System Programming
Assembler - System Programming
 
Assembler
AssemblerAssembler
Assembler
 
assembler_full_slides.ppt
assembler_full_slides.pptassembler_full_slides.ppt
assembler_full_slides.ppt
 

More from Sunita Milind Dol

Assignment No. 10 on Unit-IV Set Theory, Relations and Function
Assignment No. 10 on Unit-IV Set Theory, Relations and FunctionAssignment No. 10 on Unit-IV Set Theory, Relations and Function
Assignment No. 10 on Unit-IV Set Theory, Relations and Function
Sunita Milind Dol
 
Assignment No. 9 on Unit-IV Set Theory, Relations and Function
Assignment No. 9 on Unit-IV Set Theory, Relations and FunctionAssignment No. 9 on Unit-IV Set Theory, Relations and Function
Assignment No. 9 on Unit-IV Set Theory, Relations and Function
Sunita Milind Dol
 
Assignment No. 8 on Unit-IV Set Theory, Relations and Function
Assignment No. 8 on Unit-IV Set Theory, Relations and FunctionAssignment No. 8 on Unit-IV Set Theory, Relations and Function
Assignment No. 8 on Unit-IV Set Theory, Relations and Function
Sunita Milind Dol
 
Assignment No. 7 on Unit-IV - Set Theory, Relations and Function
Assignment No. 7 on Unit-IV - Set Theory, Relations and FunctionAssignment No. 7 on Unit-IV - Set Theory, Relations and Function
Assignment No. 7 on Unit-IV - Set Theory, Relations and Function
Sunita Milind Dol
 
Assignment No. 6 on Representation of Expression
Assignment No. 6 on Representation of ExpressionAssignment No. 6 on Representation of Expression
Assignment No. 6 on Representation of Expression
Sunita Milind Dol
 
Assignment No. 5 on Unit-III Representation of Expression
Assignment No. 5 on Unit-III Representation of ExpressionAssignment No. 5 on Unit-III Representation of Expression
Assignment No. 5 on Unit-III Representation of Expression
Sunita Milind Dol
 
Assignment No. 4 on Unit-II Mathematical Logic
Assignment No. 4 on Unit-II Mathematical LogicAssignment No. 4 on Unit-II Mathematical Logic
Assignment No. 4 on Unit-II Mathematical Logic
Sunita Milind Dol
 
Assignment No. 3 on Unit-II Mathematical Logic
Assignment No. 3 on Unit-II Mathematical LogicAssignment No. 3 on Unit-II Mathematical Logic
Assignment No. 3 on Unit-II Mathematical Logic
Sunita Milind Dol
 
Assignment No. 2 on Unit-I Mathematical Induction
Assignment No. 2 on Unit-I Mathematical InductionAssignment No. 2 on Unit-I Mathematical Induction
Assignment No. 2 on Unit-I Mathematical Induction
Sunita Milind Dol
 
Assignment No. 1 on Unit-I Fundamental Principles of Counting
Assignment No. 1 on Unit-I Fundamental Principles of CountingAssignment No. 1 on Unit-I Fundamental Principles of Counting
Assignment No. 1 on Unit-I Fundamental Principles of Counting
Sunita Milind Dol
 
Unit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and PublishingUnit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and Publishing
Sunita Milind Dol
 
Unit Number 4 - Research reports and Thesis writing
Unit Number 4 - Research reports and Thesis writingUnit Number 4 - Research reports and Thesis writing
Unit Number 4 - Research reports and Thesis writing
Sunita Milind Dol
 
Unit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical AnalysisUnit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical Analysis
Sunita Milind Dol
 
Unit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and MethodsUnit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and Methods
Sunita Milind Dol
 
Unit Number 1 - Introduction to Research
Unit Number 1 - Introduction to ResearchUnit Number 1 - Introduction to Research
Unit Number 1 - Introduction to Research
Sunita Milind Dol
 
Unit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and PublishingUnit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and Publishing
Sunita Milind Dol
 
Unit Number 5 - Research reports and Thesis writing
Unit Number 5 - Research reports and Thesis writingUnit Number 5 - Research reports and Thesis writing
Unit Number 5 - Research reports and Thesis writing
Sunita Milind Dol
 
Unit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical AnalysisUnit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical Analysis
Sunita Milind Dol
 
Unit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and MethodsUnit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and Methods
Sunita Milind Dol
 
Unit Number 1 : Introduction to Research
Unit Number 1 : Introduction to ResearchUnit Number 1 : Introduction to Research
Unit Number 1 : Introduction to Research
Sunita Milind Dol
 

More from Sunita Milind Dol (20)

Assignment No. 10 on Unit-IV Set Theory, Relations and Function
Assignment No. 10 on Unit-IV Set Theory, Relations and FunctionAssignment No. 10 on Unit-IV Set Theory, Relations and Function
Assignment No. 10 on Unit-IV Set Theory, Relations and Function
 
Assignment No. 9 on Unit-IV Set Theory, Relations and Function
Assignment No. 9 on Unit-IV Set Theory, Relations and FunctionAssignment No. 9 on Unit-IV Set Theory, Relations and Function
Assignment No. 9 on Unit-IV Set Theory, Relations and Function
 
Assignment No. 8 on Unit-IV Set Theory, Relations and Function
Assignment No. 8 on Unit-IV Set Theory, Relations and FunctionAssignment No. 8 on Unit-IV Set Theory, Relations and Function
Assignment No. 8 on Unit-IV Set Theory, Relations and Function
 
Assignment No. 7 on Unit-IV - Set Theory, Relations and Function
Assignment No. 7 on Unit-IV - Set Theory, Relations and FunctionAssignment No. 7 on Unit-IV - Set Theory, Relations and Function
Assignment No. 7 on Unit-IV - Set Theory, Relations and Function
 
Assignment No. 6 on Representation of Expression
Assignment No. 6 on Representation of ExpressionAssignment No. 6 on Representation of Expression
Assignment No. 6 on Representation of Expression
 
Assignment No. 5 on Unit-III Representation of Expression
Assignment No. 5 on Unit-III Representation of ExpressionAssignment No. 5 on Unit-III Representation of Expression
Assignment No. 5 on Unit-III Representation of Expression
 
Assignment No. 4 on Unit-II Mathematical Logic
Assignment No. 4 on Unit-II Mathematical LogicAssignment No. 4 on Unit-II Mathematical Logic
Assignment No. 4 on Unit-II Mathematical Logic
 
Assignment No. 3 on Unit-II Mathematical Logic
Assignment No. 3 on Unit-II Mathematical LogicAssignment No. 3 on Unit-II Mathematical Logic
Assignment No. 3 on Unit-II Mathematical Logic
 
Assignment No. 2 on Unit-I Mathematical Induction
Assignment No. 2 on Unit-I Mathematical InductionAssignment No. 2 on Unit-I Mathematical Induction
Assignment No. 2 on Unit-I Mathematical Induction
 
Assignment No. 1 on Unit-I Fundamental Principles of Counting
Assignment No. 1 on Unit-I Fundamental Principles of CountingAssignment No. 1 on Unit-I Fundamental Principles of Counting
Assignment No. 1 on Unit-I Fundamental Principles of Counting
 
Unit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and PublishingUnit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and Publishing
 
Unit Number 4 - Research reports and Thesis writing
Unit Number 4 - Research reports and Thesis writingUnit Number 4 - Research reports and Thesis writing
Unit Number 4 - Research reports and Thesis writing
 
Unit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical AnalysisUnit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical Analysis
 
Unit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and MethodsUnit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and Methods
 
Unit Number 1 - Introduction to Research
Unit Number 1 - Introduction to ResearchUnit Number 1 - Introduction to Research
Unit Number 1 - Introduction to Research
 
Unit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and PublishingUnit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and Publishing
 
Unit Number 5 - Research reports and Thesis writing
Unit Number 5 - Research reports and Thesis writingUnit Number 5 - Research reports and Thesis writing
Unit Number 5 - Research reports and Thesis writing
 
Unit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical AnalysisUnit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical Analysis
 
Unit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and MethodsUnit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and Methods
 
Unit Number 1 : Introduction to Research
Unit Number 1 : Introduction to ResearchUnit Number 1 : Introduction to Research
Unit Number 1 : Introduction to Research
 

Recently uploaded

1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
MadhavJungKarki
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
upoux
 
Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...
cannyengineerings
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
PreethaV16
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
Dwarkadas J Sanghvi College of Engineering
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
sydezfe
 
Accident detection system project report.pdf
Accident detection system project report.pdfAccident detection system project report.pdf
Accident detection system project report.pdf
Kamal Acharya
 
Open Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surfaceOpen Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surface
Indrajeet sahu
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
q30122000
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
nedcocy
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
PriyankaKilaniya
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
Paris Salesforce Developer Group
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
aryanpankaj78
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
harshapolam10
 

Recently uploaded (20)

1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
 
Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
 
Accident detection system project report.pdf
Accident detection system project report.pdfAccident detection system project report.pdf
Accident detection system project report.pdf
 
Open Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surfaceOpen Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surface
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
 

Handout#07

  • 1. System Programming Walchand Institute of Technology Aim: Design & implementation of Theory: 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 second pass performs synthesis of the target program. The first pass constructs an intermediate representation of the source program for use by the second pass as shown in figure. This repre structures, e.g. the symbol table, and a processed form of the source program. The latter component is called intermediate code. Figure: Overview of two pass assembly Tasks performed by the passes of a two • Pass I: 1. Separate the symbol, mnemonic, opcode and operand. Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur HANDOUT#07 Design & implementation of pass 2 of two pass assembler 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 the address information found in the symbol table. In effect, the pass performs synthesis of the target program. The first pass constructs an intermediate representation of the source program for use by the second pass as shown in figure. This representation consists of two main components structures, e.g. the symbol table, and a processed form of the source program. The latter component is called intermediate code. Figure: Overview of two pass assembly Tasks performed by the passes of a two pass assembler are as follows: Separate the symbol, mnemonic, opcode and operand. Sunita M. Dol, CSE Dept Page 1 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 the address information found in the symbol table. In effect, the pass performs synthesis of the target program. The first pass constructs an intermediate representation of the source program for use by the second pass as sentation consists of two main components—data structures, e.g. the symbol table, and a processed form of the source program. The pass assembler are as follows: Separate the symbol, mnemonic, opcode and operand.
  • 2. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 2 2. Build Symbol Table. 3. Perform LC Processing. 4. Construct Intermediate Representation. • Pass II: 1. Process IR to synthesize the target program. Pass I performs analysis of the source program and the synthesis of the intermediate representation while Pass II processes the intermediate representation to synthesize the target program. Following algorithm is the algorithm for assembler Pass II Algorithm for Pass II 1. code_area_address := address of code area pooltable_ptr := 1 location_counter := 0 2. While next statement is not an end statement then a. Clear machine_code_buffer b. If an LTORG statement then i. Process literals in LITTAB[POOLTAB[pooltable_ptr]]…….. LITTAB[POOLTAB[pooltable_ptr + 1] -1 similarly processing of constants in a DC statement i.e. assemble the literals in machine_code_buffer. ii. size := size of memory area required for literals iii. pooltable_ptr := polltable_ptr +1 c. if a START or ORIGIN statement then i. location_counter := value specified in operand field ii. size := 0 d. If a declaration statement then i. If a DC statement then Assemble the constant in machine_code_buffer ii. size := size of memory area required by DC or DS e. If an imperative statement then
  • 3. System Programming Walchand Institute of Technology i. Get the ii. Assemble instruction in machine_code_buffer iii. size := size of instruction f. If size <> 0 then i. Move the contents of machine_code_buffer to the address code_area_address + location_counter ii. location_counter := 3. Processing end statement a. Perform steps 2(b) and 2(f) b. Write code_area into output file Figure: Example of converting source program to machine language Input: 0 (AD, 01) (C, 200) Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Get the operand address from SYMTAB or LITTAB Assemble instruction in machine_code_buffer size := size of instruction If size <> 0 then Move the contents of machine_code_buffer to the address code_area_address + location_counter location_counter := location_counter +size Processing end statement Perform steps 2(b) and 2(f) Write code_area into output file Figure: Example of converting source program to machine language (AD, 01) (C, 200) Sunita M. Dol, CSE Dept Page 3 operand address from SYMTAB or LITTAB Assemble instruction in machine_code_buffer Move the contents of machine_code_buffer to the address location_counter +size Figure: Example of converting source program to machine language
  • 4. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 4 200 (IS, 04) (1) (L, 00) 201 (IS, 05) (1) (S, 00) 202 (IS, 04) (1) (S, 00) 203 (IS, 04) (3) (S, 02) 204 (IS, 01) (3) (L, 01) 205 (IS, 07) (6) (S, 03) 206 (AD, 05) (L, 00) (L, 01) 208 (IS, 02) (1) (L, 02) 209 (IS, 07) (1) (S, 04) 210 (IS, 00) 210 (AD, 03) (S, 01) + (C, 2) 204 (IS, 03) (3) (S, 02) 205 (AD, 03) (S, 05) + (C, 1) 211 (DL, 02) (C, 1) 212 (AD, 04) (S, 01) 212 (DL, 02) (C, 2) 214 (AD, 02) (L, 02) 215 Output: Intermediate Representation 0 (AD, 01) (C, 200) 200 (IS, 04) (1) (L, 00) 201 (IS, 05) (1) (S, 00) 202 (IS, 04) (1) (S, 00) 203 (IS, 04) (3) (S, 02) 204 (IS, 01) (3) (L, 01) 205 (IS, 07) (6) (S, 03) 206 (AD, 05) (L, 00)
  • 5. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 5 (L, 01) 208 (IS, 02) (1) (L, 02) 209 (IS, 07) (1) (S, 04) 210 (IS, 00) 210 (AD, 03) (S, 01) + (C, 2) 204 (IS, 03) (3) (S, 02) 205 (AD, 03) (S, 05) + (C, 1) 211 (DL, 02) (C, 1) 212 (AD, 04) (S, 01) 212 (DL, 02) (C, 2) 214 (AD, 02) (L, 02) 215 The target code 200) 04 1 206 201) 05 1 211 202) 04 1 211 203) 04 3 212 204) 01 3 207 205) 07 6 208 206) 00 0 005 207) 00 0 001 208) 02 1 214 209) 07 1 202 210) 00 0 000 204) 03 3 212 211) 212)
  • 6. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 6 214) 00 0 001 Conclusion: The second pass or Pass-II synthesizes the target form using the address information found in the symbol table. The second pass performs synthesis of the target program. Pass I performs analysis of the source program and the synthesis of the intermediate representation while Pass II processes the intermediate representation to synthesize the target program. Thus the Pass-II of two pass assembler is implemented in C-language