Giter Site home page Giter Site logo

ericjardon / dfa-reader Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 25 KB

Console program reads an automaton's transition table and generates the corresponding Deterministic Finite Automaton. It can also indicate whether a given string is accepted or not by the DFA language.

Python 100.00%
automaton dfa transition-table computational-mathematics

dfa-reader's Introduction

DFA-reader

Integrative Practice Part 1

Bryan Alexis Monroy Álvarez A01026848
Eric Andrés Jardón Chao A01376748


Description:

A program that reads a transition table from a text file and generates the corresponding Deterministic Finite Automaton.
Then it can also determine whether a given string is accepted or not by the DFA.

Modules:

  • FileReader: A functional-based module that contains functions for reading a text file given its name, and returns an instance of an Automaton given the information provided in the file's lines.
  • Automaton: A class-based module that represents a Deterministic Finite Automaton. Has as class attributes a list of states, a list of symbols, a string for the initial state and a list final states, and a transition table represented as a nested dictionary. Has methods for processing a string and a print method.
  • Minimizer: A class-based module that contains methods for minimizing an Automaton. A Minimizer has an Automaton and its main method, minimize(), directly modifies the given Automaton's transition table, initial and final states in order to minimize it iteratively and returns it. It also has basic get and set methods for the Automaton.

How do we minimize?:

The transition table of an Automaton is a dictionary with states as keys and rows as values.
Each row of the table is represented by a subdictionary of symbol:result pairs.
Thus, the Automaton table is a state-to-row mapping.
To be able to find equivalent states, we need to find states of the same type (final or non-final) and who share the same row transitions.
Our solution is to 'flip' the dictionary so we have a row-to-states mapping.
In this flipped dictionary, rows with multiple states may be redundant.
We separate such a row's states into final and non-final, and then 'collapse' their rows in the original table.
The minimizer keeps a character-based counter to give a different name to each condensed state that is introduced.
e.g. qA, qB, qC...

dfa-reader's People

Stargazers

 avatar

Watchers

 avatar  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.