Coder Social home page Coder Social logo

nfa-to-dfa's Introduction

nfa-to-dfa

This tool converts a Nondeterministic Finite Automata (NFA) into a Deterministic Finite Automata (DFA)

Using convert.py

You may provide an input NFA in one of two ways.

  1. Define the NFA via a CLI

    • When invoking the program, provide a name for the output file
      • > python3 convert.py <outputName>
    • After walking you through the NFA definition, it will create a DFA in the form of .fa
  2. Define the NFA via an input file

    • When invoking the program, provide an input file of type .nfa
      • > python3 convert.py <inputName>.nfa
    • This will create a DFA in the form of .fa

Formatting a .nfa file

The input .nfa should be formatted as follows:

  1. The first line holds a set of one or more states the NFA could initially be on, delimted by spaces.
  2. The second line holds a set of zero or more states that the NFA will accept, delimited by spaces.
  3. The following lines will define the state transitions, as a tuple, for each state you wish to define.
    • The first symbol is the current state.
    • The second symbol will be the transition symbol.
    • The following symbol (or symbols, delimted by spaces) will define the set of all states the automata will transition into.
example.nfa
1 2
3

1 a 1
1 b 2

2 a 2 3
2 b 2

3 a 3
3 b 2 3

nfa-to-dfa's People

Contributors

brycedouglasjames avatar quinnherden avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.