madhavjivrajani / simdfa Goto Github PK
View Code? Open in Web Editor NEWSimulations of deterministic finite automata in different languages!
License: MIT License
Simulations of deterministic finite automata in different languages!
License: MIT License
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?
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?
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?
It'd be great to have DFA implementations in more languages, a few of which could be as follows:
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!
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.