ALCCS
NOTE:
· Question 1 is compulsory and
carries 28 marks. Answer any FOUR questions from the rest. Marks are indicated against each question.
· Parts of a question should be
answered at the same place.
Q.1 a. Explain context-free grammer with the help of a suitable
example.
b. Differentiate between Linking
loader and Linkage editor.
c. How is forward reference resolved in single-pass assembler?
d. Write a macro that
swaps two variables.
e. List the features of
Operator-Precedence Parsing.
f. Give a regular expression for all strings of
a real number and a real number with optional fraction.
g.
What are
machine-Dependent features in assembly language? (7 4)
Q.2 a. Assemble the following program manually,
showing the resultant machine code and symbol table (Instruction set table is
given at the end)
|
START |
101 |
|
READ |
N |
|
MOVER |
BREG, ONE |
|
MOVEM |
BREG, TERM |
AGAIN |
MULT |
BREG, TERM |
|
MOVER |
CREG, TERM |
|
ADD |
CREG, ONE |
|
MOVEM |
CREG, TERM |
|
COMP |
CREG, N |
|
BC |
LE, AGAIN |
|
MOVEM |
BREG, RESULT |
|
PRINT |
RESULT |
|
STOP |
|
N |
DS |
1 |
RESULT |
DS |
1 |
ONE |
DC |
‘1’ |
TERM |
DS |
1 |
|
END |
|
b. Describe two methods for collision handling. (12+6)
Q.3 a. What
is the aim of code optimization? How is it achieved? Explain two phases of
optimization using suitable examples.
b. What are the
different phases of a compiler? Explain briefly each phase. (9+9)
Q.4 a. Give a parse tree and an AST for the source string a+b*c according
to the following grammer rules
E::=T+E|T
T::=T *V|V
V::=
<id>
b. Write an algorithm for naïve top-down parsing
c. Discuss various categories of statement used
in assembly language. (6+6+6)
Q.5 a. What
is a command dialog? Explain various ways to implement command dialogs. List
seven principles to ensure the effectiveness of command dialogs.
b. Explain Overlay structured program. (12+6)
Q.6 a. What
is an absolute loader? Explain its role, advantages and disadvantages in brief.
b. Differentiate
between a macro call and a procedure call.
c. Explain various Data Structures used by
One-Pass Macro Processor. (6+6+6)
Q.7 a. What
is an interpreter? How is it different from a compiler? What is the difference
between pure and impure interpreters?
b. What is an interactive editor? Describe
structure of an editor and its various types. (10+8)
Instruction Set Table
Symbol |
Instruction opcode |
STOP |
00 |
ADD |
01 |
SUB |
02 |
MULT |
03 |
MOVER |
04 |
MOVEM |
05 |
COMP |
06 |
BC |
07 |
DIV |
08 |
READ |
09 |
PRINT |
10 |