Q5 [15 pts]
a) Convert the following NFA to a DFA:
0 1
----------------------
-> a || {a} | {a,b}
b || {c} | {c}
c || {d} | {d}
d || {e} | {e}
* e || {} | {}
b) Informally describe the language that it accepts.
Convert the following NFA given by M to a DFA. Show your work
which includes both state diagrams.
M = ( {q0, q1, q2} , {a, b} , δ, q0, {q1}) with the state table
given
a
b
q0
{q1, q1}
q1
null
{q2}
q2
null
{q2}
For the following lexical
specification:
Give NFA and DFA
Using your DFA, Implement a lexical analyzer using the state
table approach shown in class
• keywords:
if wh pr
• Identifiers. An
identifier is a sequence of one or more letters
• Integer literals.
An integer literal is a sequence of one or more decimal digits.
• Any of the following one- or
two-character symbols:
= ( ) { }
/ * - +
< <= ==
!=
• Note...
-
Give state diagram of DFA recognizing L={w | w is 0,1-string, and
contains 3k 0s and 2m 1s for some integers k and m at least 0}. For
examples, 0010111 is in L, but 010011 is not in L. The first string
contains 3 0s and 4=2x2 1s, but the second string has an odd number
of 1s.