Skip to content

pirateksh/DFA-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

DFA-simulator

A command line simulator for Deterministic Finite Automata (DFA).

How to use ?

  • Clone this repository into a folder using git clone.
  • Open terminal and compile the dfa.cpp file. (in Linux terminal use, g++ dfa.cpp to compile).
  • Run the generated a.out file using ./a.out.
  • Firstly, you need to configure the DFA.

Configuring DFA

  • Set of inputs: Firstly, enter number of inputs and then enter all the inputs separated by a space.
  • Set of states: You just need to enter total number of states (say n) in your DFA. By default states are numbered from 0 to n-1.
  • Set of final states: Firstly, enter number of final states and then enter all the final states (remember set of states are numbered from 0 to n-1, so only enter numbers between 0 and n-1 included) present in your DFA.
  • Initial State : It is assumed to be 0 by default.
  • Transition function : For each state, starting from initial state, and for each input per state, fill the corresponding next states.
  • Sit back and relax, your DFA is now configured and ready to be used.

Testing DFA

  • Test inputs can be written in input.txt file separated by a new line character i.e. one input string per line. The configured DFA will automatically test these input strings which are specified in this file.
  • If you feel like testing on more inputs after the inputs from file are exhausted, you can even give input strings from the command line itself.

Output Format

  • For each input string, the DFA will specify whether the input was Accepted, Rejected or Invalid Input.

Contributor

About

A command line simulator for Deterministic Finite Automata (DFA)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages