0% found this document useful (0 votes)
22 views3 pages

Language Processor3

Question Paper

Uploaded by

megadata
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Language Processor3

Question Paper

Uploaded by

megadata
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CS/B.

Tech/Sem-8/IT-803B/2004-05
2005
PRINCIPLE OF LANGUAGE TRANSLATION
Time Allotted: 3 hours Full Marks: 70

The figures in the margin indicate full marks.


Candidates are required to give their answers in their own words as far as practicable.
Answer Question No. 10 and any five from the rest

i. a) Clarify the following terms with suitable examples: 3


() Token; (i) Lexeme; (ii)Pattern
b) What do you mean by regular definition? 2
c) Any string of white spaces can act as a delimiter in some language. 3
Write down the regular definition for detecting the delimiters in
that language and draw the corresponding state transition diagram.
d) Describe the structure of a Lex program. 4

2. a) What do you mean by left-recursion in acontext free grammar? 2


b) Check whether the following grammar is left-recursive or not,and 3
if yes,eliminate left recursion from the same.
E ’ E+T T
T ’T * F | F
|F ’(E) id
c) Left factor the following grammar : 3
Stmt ’ if Expr. then Stmt.
Stmt if Expr. then Stmt else Stmt.
Stmt -’ a
Expr ’ b
d) Define ambiguity in a grammar.
4
Check whether the following grammar is ambiguous:
E ’ E + E E * E id.

3. a) What do you mean by predictive parsing? 2


b) Construct a predictive parsing table for the following grammar.
bexpr ’ bexpr OR btermn bterm
bterm ’ bterm AND bfactor bfactor
bfactor ’ NOT bfactor (bexpr) |TRUE | FALSE.

-1-.
c) Using the above parsing table, parse the following sentence : 4
NOT (TRUE OR FALSE)
and draw the corresponding parse tree.
a) Discuss LR parsing algorithm with suitable diagram. 4
b) Write down the LR (O)items for the following list of productions 2

E ’ E +T T
T ’T* F F
F ’(E) |id
c) What are the advantages of LALR parsing method over SLR 2
parsing method and canonical LR parsing method?
d) Write short note on YACC. 4

5. a) What is attribute to a token ? 2


b) Differentiate between synthesized attribute and inherited attribute 3
for atoken with suitable examples.
c) Explain how bottom-up evaluation of attributes is possible for 3
S-attributed definition.
d) Define L- attributed definition. 1
e) Explain the difference between syntax-directed definition and 3
translation schemes.

6. a) Describe stack allocation as a storage allocation strategy. 4


b) Discuss four parameter passing strategies. 6
c) What do youmean by dangling reference? 2

7. a) What do you mean by three- address code? 2


b) Describethe different implementation strategies of three-address 4
codes?
c) Write down translation scheme toproduce three-address code for 6
assignment statements.

8. a) Define a basic block. 2


b) codes
Write an algorithm to partition, agiven sequence of three-address 4
into basic blocks.
6
Apply the above algorithm tofind out the basic blocks in the
c)
following code fragment:
i) prod =0
ii) i=1
ii) t =4 * i
iv) t a[t]
v) t, =4 * i
vi) ty =b[t;]
vii) ts = t, * ta
viii) t6 = prod + ts
ix) prod = ts
x) t, =i+1
xi) i=t;
xii) if i<= 20goto 3
3x4
9. Write short notes on ( any four) of the following :
a) Preprocessor.
b) Linker and Loader.
c) Data activation record.
d) Peephole Optimization.
e) Error recovery strategies incompilers.
) Symbol table.
g) Handling Reserved Keywords.
10. Answer the following inshort. lx10
a) What do you mean by bottom-up parsing?
b) Define handle ofa string in context of bottom-up parsing.
c) Define viable prefix.
d) What do you mean by shift/reduce conflict and reduce/reduce
conflict?
e) Define LR (k)grammar.
f) What do you mean by a cross-compiler?
g) What do you mean by unreachable code?
h) Write down the regular expression for the following language:
All strings of letter that contain the 5 vowels in order.
i) Define recursive descent parsing.
)) Define an operator grammar.

***

You might also like