0% found this document useful (0 votes)
47 views

Assign 3

This document describes Assignment 3 for a computer systems laboratory course. The assignment involves converting a non-deterministic finite automaton (NFA) to an equivalent deterministic finite automaton (DFA) and then using the DFA to determine whether strings are accepted. Students are asked to create a data structure to store finite automata, write a function to convert an NFA to a DFA, read an NFA from a file, convert it to a DFA and print the DFA, and then simulate the DFA on input strings to test for acceptance.

Uploaded by

venuadepu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Assign 3

This document describes Assignment 3 for a computer systems laboratory course. The assignment involves converting a non-deterministic finite automaton (NFA) to an equivalent deterministic finite automaton (DFA) and then using the DFA to determine whether strings are accepted. Students are asked to create a data structure to store finite automata, write a function to convert an NFA to a DFA, read an NFA from a file, convert it to a DFA and print the DFA, and then simulate the DFA on input strings to test for acceptance.

Uploaded by

venuadepu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CS69011 Computer Systems Laboratory I

Assignment 3 August 12, 2010

Let N = (Q, , , q0, F) be a non-deterministic finite automaton. N can be converted to a


deterministic finite automaton (DFA), M = (Q, , , q0, F) which accepts the same
language. In this assignment you will read the description of a NFA from a file and create
the equivalent DFA. Then the DFA will be simulated to determine the membership of a
given set of strings. Assume  = {0, 1}.

1. Create a data structure to store a finite automaton as a graph. We will discuss


possible data structures.

2. Write a function to create (and store) a DFA from the NFA. In general a NFA can
have -transitions.
If you feel that handling -transitions is too difficult, then you may assume that the
NFA does not have -transitions, in which case you will get half the credit for this part.

3. Write a program which does the following:

a) It reads a NFA from the input file and stores it in the data structure. A sample
input file is shown below.

b) It uses the above function to convert the NFA to a DFA. It should then print
the DFA in the format described below.

c) It reads a set of input strings from another file and simulates the DFA to test
whether each string is accepted by the DFA.

Input File Format (Sample):

3, 1, 1
1, 1, 2 1
2, 0, 2 1 0
1, e, 3 
2, 0, 3
3, 0, 1 2 3
0,1
2, 1, 3
0
First line indicates the number of states, the start state and the list of accept states. Each
other line describes a state transition in the format: PresentState, Input, NextState. The
letter “e” is used in place of .

The DFA should be printed in the same format except that states of the DFA should be
printed as subsets of states of the NFA within curly brackets. For example the DFA
transits from state {2} of the DFA on input 0 to the state {2,3}. This transition should be
printed as:
{2}, 0, {2,3}

You might also like