0% found this document useful (0 votes)
33 views4 pages

10 M FLCD QuestionBank - Updated-1

Yess

Uploaded by

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

10 M FLCD QuestionBank - Updated-1

Yess

Uploaded by

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

SRI VENKATESWARA COLLEGE OF

ENGINEERING
(AUTONOMOUS)
Karakambadi Road, TIRUPATI – 517507

10 marks Question bank


Name of the
CSE/B.Tech
Branch/Course
Subject FORMAL LANGUAGES AND COMPILER DESIGN

Subject Code CS20APC502

Year & Sem III Year & I Sem

Unit – 1
1 Explain the phases of compiler with a neat diagram and example
Construct the NFA for the following regular expressions
2 i) L= (a+b)*(aa+bb) (a+b)* ii)L=ab+(aa+bb) (a+b)*b
Convert the following NFA to DFA

Construct FA for the following regular expressions


4
a) (0+1)* (1+00) (0+1) b) 0+10* + 01*0.

Design DFA which accepts language


a) L={w/where w is of even length and begin with 01}
5
b) Design DFA which accepts strings ending with abba over {a, b}
c) Design DFA which accepts string starting with 101 over {0,1}
Consider the below finite automata and check the strings are accepted or not.

(i) 1110 (ii) 0001 (iii) 1010

Describe the following RE’s in English Language.


a) a(a+b)*abb
b) (a+b)*aba(a+b)*
7 c) (0+1)* 1(0+1)*0(0+1)*
d) (0+1)*01
e) (0+1)*(00+01+10)
Construct a DFA equivalent to the NFA.
M=({p, q, r},{0,1}, δ, p,{q, s}) Where δ is defined in the following table.
δ 0 1
p {q,s} {q}
8
q {r} {q,r}
r {s} {p}
s - {p}
Identify a DFA to accept strings of a’s and b’s ending with abb over ∑={a,b}.
Write regular expressions for the following languages over {0, 1}*.
(i) The set of all strings that begin with 01 and end with 11.
9 (ii) Set of all strings not containing 110
(iii) Set of all string containing substring 101
(iv) Set of all string beginning with 1 and ending with 100.
10 Define Regular expression. Explain the properties of Regular expressions.
Define alphabet and language. Write the Operations that can be performed on a language
11
with examples.

Unit – 2
Construct SLR Parsing table for the grammar:
E-> E+T/T, T->T*F/F, F->(E)/a
1 Show the moves of the parser for parsing the string a * a + a.

What is an ambiguous and un ambiguous grammar? Identify the following grammar is


2 ambiguous or not.
E→E+E | E*E | (E) |-E |id for the sentence id+id*id
Define Derivation and Parse Tree?
Let G be a Context Free Grammar for which the production Rules are given below:
S -> aB | bA
A -> a | aS | bAA
3 B -> b| bS| aBB
Derive the string aaabbabbba using the above grammar (using Left Most Derivation and Right
most Derivation) and construct parse tree?

Construct CLR and LALR parsing table for the following grammar:
S→ AA
4 A→ aA/b

(i) Define Left Recursion and Left factoring.


(ii) Eliminate left recursion for the following grammar.
5 E→E+T/T
T → T*F /F
F→ ( E ) / id
Check below grammar is LL (1) or not.
S → iEtSS’ / a
6 S’ →eS / ε
E→b

7 Construct Stack implementation of shift reduce parsing for the grammar


E->E+E
E->E*E
E->(E)
E->id
and the input string is id+id*id
Construct predictive parsing table and parse the string id+id*id.
E→TE’
E’→+TE’ | ε
8 T→ FT’
T’→*FT’ | ε
F→(E) | id
Show SLR parsing table for the following grammar
S → Aa | bAc | Bc | bBa
9 A→d
B→d
and parse the sentence "bdc" and "dd".
Give the LALR for the given grammar.
E→E+T|T
10 T→T*F|F
F → (E) / id and parse the following. (id + id) * id
Consider the following grammar
S → AS|b
11 A→SA|a.
Construct the SLR parse table for the grammar.
Show the actions of the parser for the input string “abab”.
Construct the SLR parse table for below grammar.
S → CC
12 C →cC / d
Show the actions of the parser for the input string “dd”.

Unit – 3
Discuss the following in detail about the Syntax Directed Definitions with
example
1 i. Inherited Atrributes
ii. Synthesized attributes.
2 Explain about L attributed definition?
3 Construct syntax tree and postfix notation for the following expression (a+(b*c)^d-e/(f+g)
4 Write the quadruple, triple, indirect triple for the statement a := b* − c + b* − c.
5 Write the intermediate code for the expression a + a * ( b + c ) * d.
Write the short note on:
6 a. Abstract syntax tree b. Polish notation c. Three address code d. Backpatching e. DAG
What is a three address code? Mention its types. How would you implement the three address
7 statements? Explain with examples.
Convert the following expression into syntax tree and three address
8 code: h=(b*-(a+b)/d)-c+6.
9 Explain the role of intermediate code generator in compilation process.
Consider following expression grammar:
S -> E
E -> E + E/E * E/(E)/I
I -> Idigit/digit
10 Digit -> 0=1=2=::::=9
Write semantic rules to evaluate expression on decimal numbers that it
derives.
Use `val' attribute for storing the values & constant parse tree for
2*(21+1)+10.
Find S.val.
Unit – 4
1 What is Type Conversion? what are the two types of type conversion? Explain
2 What is activation record? Write the various fields of Activation Record.
3 Discuss in detail about the run time storage arrangement
4 Write the definition of symbol table and procedure to store the names in symbol table.
5 Explain in brief about equivalence of type expressions with examples
6 What is type checker? Explain the specification of a simple type checker
7 What are the data structures used in symbol table? Explain.
8 Explain the Storage Organization with simple examples
9 Explain Storage allocation strategies with suitable examples?
10 Explain about Dynamic Storage allocation Techniques?
Unit – 5
1 Explain code optimization techniques on Basic Blocks with simple examples?
Consider the following program code:
Prod=0;
i=1;
Do
2 {
Prod=prod+ a[i]*b[i];
i=i+1;
}while (i<=10);
a. Partition in into blocks b. Construct the flow graph
3 Explain the peephole optimization Technique?
4 What are basic blocks? Write the algorithm for partitioning into Blocks

5 Explain about principle sources of optimization?

6 Explain issues in design of code generator?


7 What is common sub-expression and how to eliminate it? Explain with example.
Write a short note on: a. Flow graph (with example) b. Dominators
8
c. Natural loops d. Inner loops e. Reducible flow graphs
9 Explain Register allocation and Assignment
10 Construct the DAG for following statement. a+b*c+d+b*c

You might also like