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...
Automata Theory and Formal Languages
Instructions:
Draw the DFA (Deterministic Finite Automaton) of the
following:
DFA in which set of all strings can be accepted which end with
‘a’
DFA in which set of all strings can be accepted which start
with ab
DFA in which set of all strings can be accepted which contain
ab
DFA in which set of all strings can be accepted which ends with
ab
Automata Theory and Formal Languages
Instructions:
Draw the DFA (Deterministic Finite Automaton) of the
following:
DFA for binary number divisible by 2
DFA for binary number divisible by 3
DFA in which set of all strings can be accepted which start
with a
DFA in which set of all strings can be accepted which contains
‘a’
Convert the following values into binary numbers for each word
and place the binary values in
the two-dimensional array in their proper order of words.
Value
Binary Number Equivalent
Word 0
462,91210
Word 1
1142008
Word 2
5420h
Word 3
20,992d
Word 4
1104208
Word 5
6102008
Word 6
9F88h
Word 7
20,49610
Word 8
502416
Word 9
1101018
Word 10
71082h