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

ATCD

The document contains a series of tasks related to automata theory, compiler design, and parsing techniques. It includes drawing DFAs, converting NFAs, constructing regular expressions, and analyzing C code for errors. Additionally, it discusses various aspects of compilers, including phases, error detection, and optimization strategies.

Uploaded by

Shivaraj Bhagoji
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)
5 views

ATCD

The document contains a series of tasks related to automata theory, compiler design, and parsing techniques. It includes drawing DFAs, converting NFAs, constructing regular expressions, and analyzing C code for errors. Additionally, it discusses various aspects of compilers, including phases, error detection, and optimization strategies.

Uploaded by

Shivaraj Bhagoji
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/ 5

1.

Draw a DFA to accept set of all string of a’s and b’s ending with ab or ba
2. Convert the following NFA to its equivalent DFA

3. Obtain a regular expression representing strings of a’s and b’s such that third symbol from
the right is “a” and fourth symbol from the right is “b”.
4. Construct leftmost derivation and right most derivation for the string aaabbabbba using the
following grammar.
S→aB/bA
A→a/aS/bAA
B→b/bS/aBB

5. Obtain NFA to accept the following language:


L={w| w ∈ ababn or aban where n≥0}
6. Convert the following epsilon NFA to equivalent NFA

7. Draw a DFA to accept string of a’s and b’s having a substring aab
8. Obtain the DFA for the following NFA

9. Obtain a regular expression representing string of a’s and b’s whose tenth symbol from the
right is a.
10. Construct a DFA which accepts strings of 0’s and 1’s where the value of each string is
represented as a binary number. Only the strings representing zero modulo five should be
accepted.
11. Define Context Free Grammar and construct CFG to generate a palindrome over {a,b}
12. Consider the following grammar:
E→E+E ∣ E∗E ∣ id
Construct two different parse trees for the expression id + id * id and determine whether the
grammar is ambiguous
13. Draw a DFA to accept set of all strings on the alphabet Ʃ={0,1} that either begins or ends or
both with the substring 01.
14. Design an NFA to recognize the following set of stings abc, abd and aacd
15. Obtain a regular expression such that L(R)={W|W ∈{0,1}*} with at least three consecutive
0’s
16. A toll booth charges a fee based on the sum of coins inserted. The machine only allows cars
to pass if the total amount inserted is divisible by 3. Design a DFA to determine whether the
sum of inserted coins is divisible by 3.
17. Convert the following epsilon NFA to equivalent NFA

UNIT 2

18. Explain the different types of language processors


19. Explain the structure of a compiler and show how an input a=b+c*60 get processed at each
stage of a compiler.
20. Describe the grouping of compiler phases and their significance.
21. Explain LEX tool with the structure of Lex program.
22. Explain Input buffering in detail.
23. Explain the process of token recognition in lexical analysis.
24. Draw the structure of a compiler and describe various phases in the compilation process
mention the output of the following statement: “a=b+c-60” at each phase
25. Analyze the following C program and answer the questions below:
#include <stdio.h>
int main () {
int 123num = 10;
int x = 5
float y = "hello";
printf ("Value of x: %d", x);
return 0;
}
1. Identify the errors in the above code.
2. Mention which phase of the compiler should detect each error.
3.Explain why each error occurs.
4.Write a corrected version of the code.
26. What is the difference between a compiler and an interpreter?
27. List and explain different compiler construction tools and their purposes
28. Describe the role of the forward pointer and lexeme pointer in input buffering. How do they
work together to recognize tokens?
29. Who are the cousins of a compiler? Explain their roles in the compilation process
30. Explain the terms: lexeme, token, and pattern.
31. What is input buffering in lexical analysis? Explain the two-buffer scheme with an
example
32. Draw the structure of a compiler and describe various phases in the compilation process
mention the output of the following statement: “a=(b+c)*(b+c)*2 at each phase
33. Who are the cousins of the compiler? Explain their roles in the compilation process.
34. Explain the different types of errors detected during compilation. At which phase is each
type of error detected?
35. Explain LEX tool with the structure of Lex program.
UNIT 3
36. Compute FIRST and FOLLOW for the following Grammar
SBb/Cd
BaB/ ε
CcC/ ε

37. What is backtracking in parsing? Why is it inefficient?


38. Explain Table Driven predictive parsing table model
39. i Convert the following left-recursive grammar into a non-left-recursive form
Sa | ^ | (T)
TT, S | S
ii Convert the following left factoring grammar in to non -left factoring grammar
SiEts | iEtSes | a
Eb
40. Explain the role of a parser and its types in detail
41. Compute FIRST and FOLLOW for the following grammar
E'TE'
E'+TE'/ϵ
TFT'
T '*FT'/ϵ
Fid/(E)
42. Describe the function of a parser in the compilation process. What are the different types of
parsers?
43. Write a note on Non-Recursive Decent Parsing.
44. Explain Left recursive grammar and left factoring with an example.
45. Convert the following left-recursive grammar into a non-left-recursive form:
E→E+T|T
T→T*F|F
F → (E) | id
46. Consider the Grammar
E'TE'
E'+TE'/ϵ
TFT'
T'*FT'/ϵ
F(E)/id.
Design predictive parser table and check whether it is LL(1) or not?
47. Write Recursive Descent Parser for the following Grammar and check if the string id+id $ is
accepted by the grammar or not.
E'TE'
E'+TE'/ϵ
TFT'
T'*FT'/ϵ
F(E)/id
48. What is a Grammar. Explain CFG.
49. Construct predictive parser for the following grammar
EE+T/T
TT*F/F
F(E)/id
Construct the behaviour of the parser on w=id+id*id using the grammar specified
UNIT 4
50. Explain Syntax-Directed Definitions (SDD) with an example.
51. Construct CLR (1) parsing table for the given grammar
SAA
AaA
Ab
52. Construct LR (0) parsing table for the given grammar
EE*B
EE+B
EB
B0
B1
53. Explain the working of a Yacc Parser Generator
54. What are the key applications of SDD in language translation and semantic analysis?
55. Construct LALR (1) parsing table for the given grammar
SAA
AaA
Ab
56. Explain about bottom-up parsing in detail
57. What are the applications of SDD
58. Trace the handle pruning process while parsing the input "abbcdc" using a shift-reduce
parser. List the handles detected in each step and the final reduction sequence.
SaABc
AAbc/b
Bd
Unit 5
59. Construct a Basic Block Flow Graph for the following code:
if (x > 10)
y = x + 5;
else
y = x - 5;
z = y * 2;
Identify the number of basic blocks
60. Construct the syntax tree for the following expression
x*y-5+z
61. Explain principal sources of optimization
62. Explain in detail about storage organization
63. Construct triples of an expression a*-(b+c)
64. Differentiate between basic block and flow graph
65. Briefly explain about variants of syntax tree
66. Generate three address code for the following program fragment
while (a<c and b>d) do
if a=1 then c=c+1
else while a<=d do
a=a+b

67. Discuss the following: Copy propagation, Dead code elimination


68. Write three address code, quadruples, triples and indirect intermediate code for
1.a+b+(c+d)+d+e+a
2.a=(-c * b)+(- c * d )
69. Construct the DAG for the following block
a := b*c
d := b
e := d*c
b := e
f := b+c
g := f+d

70. Write design issues in code generator and explain memory manager
71. Write the quadruples, triples and indirect triples for the expression –(a+b) + (c+d)
72. Assume a procedure P has 4 local variables (each 4 bytes) and calls another procedure Q
that needs 3 parameters. If the return address takes 8 bytes, compute the total stack space
allocated when P calls Q
73. Consider the following three-address code. Draw its DAG representation. Show the DAG
after labelling using the labelling algorithm
t1 =a+b
t2 =c+d
t3=e-t2
t4=t1-t3
74. Explain the different storage allocation strategies.
75. Write a three-address code for the following C statement
if((a<b) and ((c<d) or (a>d))
Then z= x + y*z
else z= z+1

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