GithubHelp home page GithubHelp logo

madhavjivrajani / simdfa Goto Github PK

View Code? Open in Web Editor NEW
11.0 5.0 5.0 41 KB

Simulations of deterministic finite automata in different languages!

License: MIT License

Python 10.96% JavaScript 6.97% C++ 10.57% Go 9.12% Racket 6.30% Haskell 6.43% Nim 9.04% Java 13.43% Rust 15.14% Julia 12.05%
dfa python javascript simulation oops-in-python oops cpp oops-in-cpp golang go

simdfa's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

simdfa's Issues

Ambiguous start state in Python Implementation.

Python/dfa.py, Line 32:

    def add_state(self, is_start, is_final, name):
        if name not in self.states:
            self.states[name] = State(is_start, is_final, name)
        else:
            print("State already exists!")

Shouldn't we check if any other state has already been marked as Start State?
Maybe the assumption is that that the automaton user inputs is correct but why not add this check?

Printing to STDERR and/or Using Logger

Since the size of the implementation is only 3-4 files in every language, printing to STDERR in case of errors might be a good thing from a design perspective. Using logger might be an alternative ig?

Check for invalid number of start states.

In implementations of many languages, a basic assumption followed is that the DFA the user inputs is correct but some things might turn out wrong during runtime.
Maybe one of many:
What if the user mistakenly marks more than one state as start state?

So, why not check if there is exactly one start state before checking the test-string?

Need DFA implementation in more languages

It'd be great to have DFA implementations in more languages, a few of which could be as follows:

  • Rust (taken)
  • Scala
  • Julia
  • C
  • Ruby
  • Kotlin
  • Java (taken)

If you would like to contribute in another language that is not mentioned in the above list, then please feel free to do so! Leave a comment mentioning the language you would like to contribute in!

Linters

Since implementation in every language doesn't contain more than 3-4 files, for consistency in the code, setting a linter for every language could be an idea. Adding this to CONTRIBUTING.md I suppose?

PS: Choosing a linter based on the popularity, availability etc could be a task. So, maybe open a new issue just for that?

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.