Question Bank CD - Final 2022-23
Question Bank CD - Final 2022-23
Question Bank CD - Final 2022-23
6. Explain with example what are Tokens, Patterns & Lexemes. Elaborate in detail the
specification of tokens.
7. Give the output generated by Lexical Analyzer for each of the following. Identify
Tokens and Lexemes. Also give reasonable attributes value for token:
If (i<j)
max=i;
else
max=j;
Unit-III
Unit-IV
1) Show the DAG representation for expression a+a*(b-c)+(b-c)*d. List and explain the
instruction constructing for the above DAG.
2) Consider the following grammar
D→TL, T→ int/real, L→L1, id/id
i)Give the Syntax-directed definition with inherited attributes
ii)The parse tree for the real id1,id2,id3 and explain with inherited attributes at each
node
iii)Explain what is dependency graph is and construct D.G. for above parse tree.
3) Consider the following grammar for a desk calculator
L→En
E→ E1+T /T ,T→ T1*F/F, F→(E)/digit
i) Give a syntax-directed definition for this grammar to evaluate the given string and
and print the value „n‟ which indicates new line character
ii) Draw the annotated parse tree for 3*5+4n
iii) Give the implementation of this desk calculator with an LR parser
iv) Shows the moves of parser for parsing the string 3*5+4n
4. Consider the following grammar.
L→E
E→E1+T
E→T
T→T1*F
T→F
F (E)
F→digit
Where digit is terminal symbol
a) Obtain the syntax directed definition for the above grammar.
b) Give the implementation of above grammar using an LR Parser.
c) Show the moves made by the translator of part (b) on input 5+3*4.
5.What are syntax directed Translations? What are its types? Explain with suitable example.
6.Construct the DAG for:a+a+(a+a+a+(a+a+a+a))
What is the syntax directed definition for the simple desk calculator, write and explain. What
would be the parse tree for 1*2+3n?
7. Consider the following grammar.
E→E1+T|E1-T|T
T→ (E) |id | num
Where id and num are terminal symbols.
a) Obtain syntax directed definition for constructing syntax tree for the above
grammar.
b) Obtain suitable translation scheme for the definition in (a) above.
c) Show the steps for construction of syntax tree for expression „x-5+y‟
Unit-V
1. What do you mean by activation record? Explain general activation record structure
2. Describe each of the following-
i) Activation Record
ii) Activation Tree
3. Explain Storage allocation strategies and explain Stack allocation in detail.
4. Explain the subdivision of Run time memory.
5. Explain pass by value and pass by reference in detail.
6. What do you mean by Symbol table and symbol table entries? Explain how scope of
information is represented in symbol table.
7. Explain the following
i. control stack ii. Scope of declaration
8. Explain static and stack allocation strategies in detail.
Unit VI
1. Explain Basic Block and Flow Graph in detail?
2. Explain the run time storage management.
3. Consider the assignment statement.
a:=b*-c+b*-c
Construct the intermediate representation
i) Syntax Tree
ii) Directed Acyclic Graph
iii) 3 Address code corresponding to the syntax tree and DAG
4. Write the three address code for the following code fragment.
For(j=1;j<=10;j++)
Sum=sum+a[j]+b[j];
5. Explain generic issues of code generator.
6. Explain translation scheme for addressing array elements
7. write a three address code for the following code fragment
main()
prod=0;
i=1;
do begin
prod:=prod+a[i]*b[i];
i=i+1;
end
while i<=20
end
8. Explain Basic Block and Flow Graph in detail?
9. Explain Implementation of three address statements with the help of suitable
example