Converting regular expression in nfa - thompson construction


Question 1)a) Define compiler? What are the various compiler construction tools describe in detail?

(b) Why intermediate code generation is not included in front end or back end?

(c) Consider the following grammar.

S     XaYb
X    bXc | b
Y    dYa | d

Determine the first set for each non-terminal of the given grammar.

Question 2)(a) Construct a Syntax-Directed Translation scheme that takes strings of a’s, b’s and c’s as input and produces as output the number of substrings in the input string that correspond to the pattern a(a|b)*c+(a|b)*b. For instance the translation of the input string “abbcabcababc” is “3”.

Your solution must include:

1. A context-free grammar that generates all strings of a’s, b’s and c’s

2. Semantic attributes for the grammar symbols

(b) What is Abstract Stack machine. Describe in detail with the help of appropriate examples?

Question 3)(a) Define lexical analysis? Also explain roles of lexical analyzer in detail.

(b) What is Input Buffer? Describe in detail?

Question 4)(a) Define Parser. Elaborate Top down parser in detail with the help of appropriate examples.

(b) Convert the following regular expression into NFA using Thompson’s construction.

a(a|b)*c+(a|b)*b

Question 5)(a) Convert NFA into DFA of the following:

i. (a | b)*

ii. (a* | b*)*

Question 6)(a) Define Type Checking. Write down the difference between Static and Dynamic Type checking?

(b) What is the Specification of a simple Type Checker?

Question 7) Describe unification algorithm in detail with the help of appropriate examples.

Question 8)(a) Describe Back patching in detail with the help of suitable examples.

(b) Explain Procedure Call with the appropriate example.

Question 9) Convert the following LR grammar to right recursive grammar:

E → E + T / E – T / T
T → T x F / T / F / F
F → (E) / Numbers
Numbers → 0/1/2………………/9.

Question 10) Write a brief notes on the following topics:

(a) Peephole optimization

(b) Loops in flow graphs

(c) Iterative solution of data-flow equations.

Request for Solution File

Ask an Expert for Answer!!
Theory of Computation: Converting regular expression in nfa - thompson construction
Reference No:- TGS05961

Expected delivery within 24 Hours