Question: Could you please help with the following problems? 1. (a) The following is Finite State Automaton A: 2. (a) (b) (i) (d) (i) What are
Could you please help with the following problems?
1. (a)
The following is Finite State Automaton A:
2. (a) (b) (i)
(d)
(i) What are the first eight strings of L(A) if going by lexical order?
(ii) What are the first four strings of L(A) if going by dictionary order?
(iii) ConversionofthefinitestateautomatonAtoaregularexpression:
Add new initial and final states. If state 1 is removed first what is the resulting machine? If state 2 is removed first what is the resulting machine? If state 3 is removed first what is the resulting machine?
(iv) Write a regular grammar which defines the same language as finite state automaton A. Remember: a grammar is regular if each production is of the form: N -> t, or N -> tB, or N -> .
(b) Write a regular expression for each of the following languages:
(i) The language of all strings over {0, 1} which do not contain 00 as a substring
(ii) The language of all strings over {0, 1} which do not contain 101 as a substring
Write a context free grammar for the language {aibjak: i = j + k}, and show a right derivation for the string: aaaaabbaaa
Show that the grammar below is ambiguous. S -> S * S
S -> S + S
S -> num (ii) Write an unambiguous grammar to define the same language. Make sure that addition and multiplication
have the usual precedence (i.e. 2+3*4=14, not 20). (c) Consider the grammar
S -> aS | aSbS |
(i) (ii)
Show a derivation for aab Show that the grammar is ambiguous.
R-> R* | (R) | R+R|RR | letter is a grammar which recognises regular expressions.
Show a derivation for (ab + c)* where a,b,and c are recognised as letter. The grammar is ambiguous. Give an unambiguous grammar which recognises regular expressions, and which produces
derivation trees which correspond to the way in which regular expressions are interpreted.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
