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

Last Year Questions

1. The compiler will lexically analyze, parse, semantically analyze, generate intermediate code, optimize and generate machine code for the string A=B*C+D/E. 2. An operator grammar defines the precedence of operators. The parsing table shows the precedence of +, *, and id for the given grammar. 3. An activation record stores information for a function call including parameters, local variables, return address, and more.

Uploaded by

Vikas Srivastav
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)
78 views

Last Year Questions

1. The compiler will lexically analyze, parse, semantically analyze, generate intermediate code, optimize and generate machine code for the string A=B*C+D/E. 2. An operator grammar defines the precedence of operators. The parsing table shows the precedence of +, *, and id for the given grammar. 3. An activation record stores information for a function call including parameters, local variables, return address, and more.

Uploaded by

Vikas Srivastav
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/ 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy