You are on page 1of 1

1 Discuss the action taken by every phase of the compiler on the following string:

A=B*C+D/E
2 What is an Operator Grammar? Design the Operator precedence parsing table for the following
grammar:
R → R+S|S
S → S*T|T
T → id
3 What is an activation record? With the help of the diagram show the important fields in an
activation record.
4 Design Syntax tree and DAG for a given expression. Also, write all the steps required to draw trees.
a+b*c-d/ (b * c)
5 With the help of the parse tree, how will you determine whether the grammar is ambiguous or
not? Explain using a suitable example.
6 What are the typical entries in a symbol table, and what are the various data structures used to
implement the table?
7 What is LR parsing? How LR parsing is different from LL Parsing?
8 (i) Left factor the following grammar:
S→iEts/iEtSeS/a
E→b
(ii) Consider the following grammar and remove left recursion:
S→Bb/a
B→Bc/Sd/e
39 Design SDT for given grammar and generate the result of the expression ((6 –(2-4))*3). Draw a
proper semantic parse tree with navigation to show the output. Create a 3-address code for switch
case statement for a program in C language, to find a weekday and weekend (1 st and 7th day is
weekend).
E->E * T
E->T
T->F-T
T->F
F->6/2/4/3
10 Construct CLR parsing table with goto diagram for the grammar:
E→ E+T |T
T→ id
11 Parse the input string
int id1, id2;
using LL (1) predictive parser for the grammar
S → TL;
T → int | float
L → L, id1 | id2
12 Explain the Symbol Table Management System.
13 Evaluate the output if we carry out the following SDT to generate “aaaabcc”. Draw a proper
Semantic Parse tree with navigation to generate the output. Also, differentiate S-Attribute and L-
Attribute, support each difference with an example.
S→ aaA {printf(“Hello”);}
S→ b {printf(“DIT”);}
A→ Sc {printf(“University”);}
14 Let G be a context free Grammar
S→ bB/aA
A→ b/bS/aAA
B→a/aS/bBB
For the string “bbaababa” Find:
(i) Left Most derivation (LMD)
(ii) Right Most derivation (RMD)
(iii) Parse Tree

You might also like