0% found this document useful (0 votes)
33 views

System Storage and Compilers

This document contains questions about compiler design and implementation topics such as assembler design, macro processing, loaders, linking, and relocation. It includes questions about one-pass and two-pass assembler algorithms, assembler directives, object file formats, and handling of relocatable programs. It also provides code snippets and asks for the generated object programs and target addresses for instructions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

System Storage and Compilers

This document contains questions about compiler design and implementation topics such as assembler design, macro processing, loaders, linking, and relocation. It includes questions about one-pass and two-pass assembler algorithms, assembler directives, object file formats, and handling of relocatable programs. It also provides code snippets and asks for the generated object programs and target addresses for instructions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Module1 – Question Bank

1. Bring out the difference between system software and application software. Given examples
for each. 6M
2. Discuss the architecture of a SIC machine. 10M
3. Discuss the architecture of a SIC/XE machine. 10M
4. With reference to SIC and SIC/XE machine architecture, compare memory, Registers, data
formats, instruction formats and addressing modes. 10M
5. With reference to SIC/XE machine architecture, explain instruction formats and addressing
modes, clearly indicating the settings of different flag bits. 10M
6. What are assembler directives? Explain. Write the fundamental functions of assembler. 6M
7. List the functions of the two passes of assembler. 6M
8. With an illustrative example, explain the need for a two pass assembler. Explain the different
data structures used in 2-pass assembler. Mention their functions clearly during pass1 and
pass2. 10M
9. With brief explanation write the algorithm of Pass-1 of two pass assembler. 8M
10. With brief explanation write the algorithm of Pass-2 of two pass assembler. 8M
11. List all the Machine dependent and Independent assembler features. 6M
12. What is program relocation? Why is it required? Explain the problems associated with it &
their solutions. 10M OR
What is a relocatable program? Explain the concept of program relocation with an example
program segment. Specify how the relocation information is passed on to the loader with
necessary example. 10M
13. Briefly explain each & every record format of an object program for SIC/XE machine. 5M
14. What is a literal? With example explain how are literals handled by an assembler in the
presence or absence of LTORG? 5M
15. Differentiate between literal and immediate operand with an example. 4M
16. Explain the following machine independent features of an assembler: i) Symbol-Defining
statements ii) Expressions 8M
17. Define program block. How are they handled by an assembler? Explain with an example. 10M
18. Define control section. Explain how linking is performed between control sections. 10M
19. Give the formats for DEFINE and REFER records? Also, give the format of the revised
Modification record. 6M

Problems:
Give the target address generated for the following instruction, if:
(B)=006000, (PC) = 003000, (X) = 000090
i) 010030 ii) 0310C303 iii) 002600 iv) 03C300 8M

Generate the complete object program for the following SIC/XE assembly language
programs.

1.

SUM START 0
FIRST CLEAR X
LDA #0
+LDB #TOTAL
BASE TOTAL
LOOP ADD TABLE,X
TIX COUNT
JLT LOOP
STA TOTAL
COUNT RESW 1
TABLE RESW 2000
TOTAL RESW 1
END FIRST

2. SUM START 0
FIRST LDX #0
LDA #0
+LDB #TABLE2
BASE TABLE2
LOOP ADD TABLE, X
ADD TABLE2, X
TIX COUNT
JLT LOOP
+STA TOTAL
RSUB
COUNT RESW 1
TABLE RESW 2000
TABLE2 RESW 2000
TOTAL RESW 1
END FIRST

Assume: LDX-04, LDA-00, LDB-68, ADD-18, TIX-2C, JLT-38, STA-OC, RSUB-4C

3. Use the opcodes given below for the mnemonics in the source program:
CLEAR – B4 LDT-74 LDCH-50
STCH-54 TIXR-B8 JLT-38

COPY START 0
CLEAR X
LDT #11
MOVECH LDCH STR1, X
STCH STR2, X
TIXR T
JLT MOVECH
STR1 BYTE X’5445535440535452494E47’
STR2 RESB 11
END COPY

4. Use the opcodes given below for the mnemonics in the source program:
CLEAR-B4 LDT-74 LDCH-50
STCH-54 TIXR-B8 JLT-38

COPY START 0
FIRST CLEAR X
LDT #3
MOVECH LDCH STR1, X
STCH STR2, X
TIXR T
JLT MOVECH
STR1 BYTE C’EOF’
STR2 RESB 3
END FIRST

Extra Questions:
Write an algorithm for One-Pass Assembler. Explain how forward reference problem is handled
in One-Pass assembler. 10M
Outline the logic flow for a simple one-pass load-and-go assembler.
With suitable example, explain multi-pass assembler.
Mention the basic functions of a macro processor. Taking a suitable example, discuss the usage of
various data structures in handling the macro definitions and macro expansions.
Write an algorithm for macro definition and macro expansion.
What is a loader? What are its advantages and disadvantages? Explain the bootstrap loader with
algorithm or source program.
Give and explain the algorithm of an absolute loader
Explain in detail, SIC/XE relocation loader algorithm with suitable example.
What is a relocating loader? Explain the relocation bit technique for specifying relocation as a part
of object program.
Explain the various data structures used for linking loader.
Discuss the detailed design of a linking and relocating loader with an example. Hence explain how
program linking and relocation is performed by a linking loader when the subprograms use
external reference.
Write pass 1 and pass 2 algorithm of linking loader.
What is dynamic binding? Explain the process of loading and calling of subroutine using dynamic
linking loader.
Differentiate the processing of an object program by linking loader and linkage editor with
necessary diagrams.
List any 5 loader option commands.

Consider the below Object Program (Figure 2.8 in textbook):

Show the representation of loading this object program into memory (Refer Slide 123 of ppt)
Medle

OExplañs anauaae rocessia sue ra


e ke Qaneyal t . o r e o oCampster Bxpe

se os3ieocme stokesd e
Saos eanRGio
postba
oupu eo ase & houw oute,s o
Sumbor ake Wh aCome lex
Cxpoñn e nee Du e paaSes ia O CoMler-
(D e comptex ceMshodi ocS
W t Sepexote Lexiea Aaasis & fosi
Awsi Smth Sest mpreau Conlex dpeie
hancia Coomkec bstabtk

what isspimizb i Comler Sesienis& exple he


desig obteie hat he tompe egfîmiza9bu musr mee
Oare a wote S apefeang Comp\er techvneloas
L t expoiae daxe çraprsh on Slckibn echisues

Owk a diaae esplol he Adexact L lexical


ono ex paxsex
s t SPa tosks pexone exiss novu2ey
O Se e eascngx e sepexotiou oger gor hn
o Compsler Sdo leteawosissutas ovo Phases
Delsae heooote s o exnietolteijcotenleseche
DRscusesues or Ctors lescal asuai eor recave
iasn cowbe perhe

enpo ho0 seuhes are handles usia bers


d
gaxee e e
a ts recoraRo esea.Gpassishile o psuede cele
beow
3ranho o sasme 3 cAd As oblo Trae
ferSexr mpue =cad. xon Hesbad.

Or delSne 2Lle e s 0ss ipedleclee


axsinsredussobtoin s t &loto toles er
he efommoy CA ro o
h e mea LL LLD aramomax
Mate on odasAn oshu he preSeh ve Rarq
ARe

he xe>u amMox i LLCD_x no oiu


o osex (predoRie a-(Saae)
Wate an alaciand Mede r h e SaMe
b for a ea gasnchaz e
no houthe MveS made
b preseNe poser on he Sapu shi
leu ès an exrb dete dufe pxedae passa

e SeqyeCoe yedusiox steps Saps siy

lao ensbhos

exostpe
67

R yeoc po-a 2 La e ac9us


eSuco
resco
owses
C
RaPteducopavi
Gntt Module - Chapter
hat
ostton-u pading ? Explain hy Shosigy
anena recluctln steyas dor ang irput Jtsin
(aken G exanyple) EX S
T
TL
int
LLfd"| id 233
e int a, bC fd a | b l c
hat meank HoncHondle Porummg ) Shos Ua hondles
t Parse
wned
sS+ | Ss a
S Sti
String (takon a
T P aaa a
Put

++
ercple) 235
hat j sht tdua paser List tle actlono S
shik vecuco Pas - t an
exanple, ekpain le
tack
inolemerkatlon JhE Fedue crses 235

ExolainLe Conl ct t ay OcCu Cung


eduo
porsin 38
Moduk 4

Expla detai U Struuture LEX P


a
Gammar
betwen a
Exyplo in Ela COm u nitatin

Pare ard a lees

Exploin
h On xunple
cletnil the Stubuc o 24CPg,
Lith
exolc, pb dyernce bet")
LEX and Hand- ssitkn Lexe
Lht CA
Kea eypin) Eypla jn
lyeent meta chora tea ed
with xaple
in
LEXprog nn
Eplain Juntkis
Jylo () olhing
y3 in ()
)yparse ()
Eypa in
exayple
SJt /@dutaPari wed in yace ith
Lhet Jac Ctanat Po yatain.

Hos do e ove Ge tle


ambisitle n an
a thmatle yeen in yacc .

Eplain.
Als shen Cannt ue precedena ule
Chayate-S
Byine S DD So
explain t
Rxplain STT
Guwe
exacles Jor
kindo
cadh.
atbbute o r rornttr uncls

In herited & Syntheshd altbula) P


Eyplain ollswin
o l l o i n o s s e p t SDD
ith ecmole
a S-attslbtd deyindieng
L-octibuted delinction R 32

/or
4 hat i Onnotatd
(Pre brre 9 Loite tree
Syntou beej Porse
SOD er a
inmple dusk Cal culot Show U , annotale
Pase rte Ao premism (3+ (S+ C). & 3G
3 S+ n
Givee On SDD Jor a 2ingple desk Calcdatr go omrd
utatle

o bp-dou Pasig. le He anmtatd pa


e p rcm len
1 9 3
3S
What SDDor ipad mgole
Olependsncuy yoh Give a
3/o, 313
Pe de darakion includng int oet typeo
Como mkE anntuud Parse tee dependangy 9h
hP s16
input loak a,b,C
Chapter 6
ill help in
DAG? Exp lain hous DAG
hat i a

inttrmediate Codle eneration

Constuct a DAG to the Cvr1thmetc epredin


o n s t eting
a +a xb-d) +
(b-) xd. Sho the Heps for
te DAG
tuvo Value-number methodo fr Gnsbruck inn
3 Erplain he 36%
DAGS

what jo a 3-add rus Code ) Listthe Conr on 3-add rew

inst rck ion forrms Pg S64


the olil/eret ays of
of epreo enting te 3-addyes
Evpla in
Codss (n daka Abukure. t h exanypleo

Trano lake the bels s ar1thmekle xpreuir into


a Syntasc bes
Claadrpleo Triplea d) Tnaliet biples
1 a by -C +b C
2) a+-(b+c
Gle the
dierenca etoun 3 -add reu Code SSA P369
Chepk-8
)hat Gd generato Gve te
and
a
2primao tao de grerabo .

Eyplain the main Sgue in te design of ode


Grenvak im
P
3 Lst eplain e dif ornt kinds ok instutklons and
addre Ssin mods a
yai lable in
torge Mc aAstydan_uaa

You might also like