Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 a) The following is Finite State Automaton A: (i) What are the first eight strings of L(A) if going by lexical order? (ii) What

1 a)

The following is Finite State Automaton A:

image text in transcribed

(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

2 a) Write a context free grammar for the language {aibjak: i = j + k}, and show a right derivation for the string: aaaaabbaaa

b) i) 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).

Answer A or B:

A) E -> E + T

E -> T

T -> T * F

T -> F

F -> num

B) E -> E * T

E -> T

T -> T + F

T -> F

F -> num

c)

Consider the grammar

S -> aS | aSbS |

(i) Show a derivation for aab

(ii) Show that the grammar is ambiguous.

d)

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.

3 0 0 2 0 3 0 0 2 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago