{"id":19720208,"url":"https://github.com/arhcoder/pytomatas","last_synced_at":"2025-02-27T17:46:50.607Z","repository":{"id":172385512,"uuid":"649220305","full_name":"arhcoder/Pytomatas","owner":"arhcoder","description":"🧿 My own Python Library (available on PyPi) to implementate and simulate Automatons like DFA, NFA, PDA and Turing Machine for real projects, with documentation, examples and a project example :3","archived":false,"fork":false,"pushed_at":"2023-06-05T02:36:50.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-30T01:02:35.764Z","etag":null,"topics":["automata","automatas","library","pypi","python","simulator","states-machine","turing-machine"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pytomatas","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arhcoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-04T07:04:10.000Z","updated_at":"2023-06-04T23:39:56.000Z","dependencies_parsed_at":"2023-09-24T10:05:22.922Z","dependency_job_id":null,"html_url":"https://github.com/arhcoder/Pytomatas","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"137a6c54d6e6b600330283b4d4650e8e9e6ea492"},"previous_names":["arhcoder/pytomata","arhcoder/pytomatas"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arhcoder%2FPytomatas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arhcoder%2FPytomatas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arhcoder%2FPytomatas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arhcoder%2FPytomatas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arhcoder","download_url":"https://codeload.github.com/arhcoder/Pytomatas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241040630,"owners_count":19898907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automata","automatas","library","pypi","python","simulator","states-machine","turing-machine"],"created_at":"2024-11-11T23:10:45.663Z","updated_at":"2025-02-27T17:46:50.582Z","avatar_url":"https://github.com/arhcoder.png","language":"Python","readme":"# 🤖 Pytomatas\n\n**📌 Version 1.1.4**\n\n\u003chr\u003e\n\nPytomatas allows to simulate Acceptor Automata in the console with Python, implementing its characteristics using different definitions (mathematics included), with the following types:\n\n* **[DFA](https://github.com/arhcoder/Pytomatas/blob/master/docs/dfa.md  \"DFA\") (Deterministic Finite Automaton)**;\n* **[NFA](https://github.com/arhcoder/Pytomatas/blob/master/docs/nfa.md \"NFA\") (Non-deterministic Finite Automaton)**;\n* **[PDA](https://github.com/arhcoder/Pytomatas/blob/master/docs/pda.md \"PDA\") (Push-Down Automaton)**;\n* **[TM](https://github.com/arhcoder/Pytomatas/blob/master/docs/tm.md \"TM\") (Turing Machine)**;\n\nWhat can do?\n\n- Create and manage various types of automaton: DFA, NFA, PDA, TM.\n- Visualize automata information in console.\n- Simulate automata acceptors based on strings.\n- Observe the processes of steps and transitions when introducing a string to the automaton.\n\n\u003cbr\u003e\n\n## 📍 Index\n\n- **🛠 [Installation](#-installation)**;\n- **💻 [Usage](#-usage)**;\n  - **🧿 [First implementation](#-first-implementation)**;\n  - **🧿 [Second implementation](#-second-implementation)**;\n- **📓 [Documentation](#-documentation)**;\n- **📚 [Examples](#-examples)**;\n  - **🤖 [DFA](https://github.com/arhcoder/Pytomatas/blob/master/docs/dfa.md  \"DFA\")**;\n  - **🤖 [NFA](https://github.com/arhcoder/Pytomatas/blob/master/docs/nfa.md \"NFA\")**;\n  - **🤖 [PDA](https://github.com/arhcoder/Pytomatas/blob/master/docs/pda.md \"PDA\")**;\n  - **🤖 [TM](https://github.com/arhcoder/Pytomatas/blob/master/docs/tm.md \"TM\")**;\n  - **🔐 [Safebox](https://github.com/arhcoder/Pytomatas/blob/master/docs/xsafebox.md)**;\n- **📁 [Repository](#-repository)**;\n- **✍ [Contributing](#-contributing)**;\n- **📜 [License](#-license)**;\n\n\u003cbr\u003e\n\n## 🛠 Installation\n\nYou can install Pytomatas using pip:\n\n```bash\npip install Pytomatas\n```\n\n\u003cbr\u003e\n\n## 💻 Usage\n\nThere are two ways in which automata can be implemented:\n1. Creating the empty automaton and then adding the properties.\n2. Creating the automaton by passing its characteristics as in the mathematical definition.\n\nExample of a DFA implementation...\n\n#### 🧿 First implementation\n\n**1. Creating empty automata and then give the data:**\n\n```python\nfrom Pytomatas.dfa import DFA\n\n# Creates a DFA called \"my_dfa\":\nmy_dfa = DFA()\n\n# Define to \"my_dfa\" a set of states names:\nmy_dfa.setStates( {\"q0\", \"q1\", \"qfinal\"} )\n\n# Define to \"my_dfa\" a set of states characters of the alphabet:\nmy_dfa.setAlphabet( {\"a\", \"b\"} )\n\n# Set the \"Initial state\" name of \"my_dfa\":\nmy_dfa.setInitial( \"q0\" )\n\n# Define to \"my_dfa\" the set of \"Final states\" names:\nmy_dfa.setFinals( {\"qfinal\", \"qf2\"} )\n\n# Add transitions to the DFA:\nmy_dfa.addTransition( (\"q0\", \"a\", \"q1\") )\nmy_dfa.addTransition( (\"q0\", \"b\", \"qfinal\") )\nmy_dfa.addTransition( (\"q1\", \"a\", \"q1\") )\nmy_dfa.addTransition( (\"q1\", \"b\", \"q1\") )\nmy_dfa.addTransition( (\"qfinal\", \"a\", \"qfinal\") )\nmy_dfa.addTransition( (\"qfinal\", \"b\", \"qfinal\") )\n\n# Add more data to the existing one already in the automata:\nmy_dfa.addSymbol(\"c\")\nmy_dfa.addState(\"qx\")\nmy_dfa.addState(\"finalState2\")\nmy_dfa.addFinal(\"finalState2\")\n\n# Prints the DFA information:\nmy_dfa.show()\n\n# Check if a string is accepted on the defined automata \"my_dfa\":\n# It returns True or False if the string is accepted or not:\nword = \"aaabb\"\nmy_dfa.accepts(word)\n\n# Checks if the string is accepted, but prints all the process and steps on transitions;\n# Shows the flow of states while reading the string;\nmy_dfa.accepts(word, stepByStep=True)\n```\n\n#### 🧿 Second implementation\n\n**2. Creating the automata passing the data:**\n\n```python\nfrom Pytomatas.dfa import DFA\n\n# Declare the States:\nQ = {\"q0\", \"qa\", \"q1\", \"qb\", \"q2\", \"qf\", \"qx\"}\n\n# Declare the Alphabet:\nA = {\"a\", \"b\"}\n\n# Declare the Initial (start) state:\nS = \"q0\"\n\n# Declare the Finals states:\nF = {\"q2\", \"q3\"}\n\n# Declare the Transitions:\nT = [\n\t(\"q0\", \"a\", \"qa\"),\n\t(\"q0\", \"b\", \"q1\"),\n\t(\"qa\", \"a\", \"qa\"),\n\t(\"qa\", \"b\", \"qb\"),\n\t(\"qf\", \"b\", \"qf\"),\n\t(\"qx\", \"a\", \"qx\"),\n\t(\"qx\", \"b\", \"qx\")\n]\n\n# Declare the Automata:\nmy_dfa = DFA(Q, A, T, S, F)\n\n# Show the automata information:\nmy_dfa.show()\n\n# Check if a string is accepted on the defined automata \"my_dfa\":\n# It returns True or False if the string is accepted or not:\nword = \"aaabb\"\nmy_dfa.accepts(word)\n\n# Checks if the string is accepted, but prints all the process and steps on transitions;\n# Shows the flow of states while reading the string;\n# It returns True or False if the string is accepted or not:\nmy_dfa.accepts(word, stepByStep=True)\n```\n\n#### 🛑 NOTE: These are only implementation examples, not actual implementations, so they are not complete real automata definitions 👆\n\n* For more detailed information about the attributes and methods of the class, refer to **[Documentation](#-Documentation  \"Documentation\")**.\n\n* For more detailed usage instructions and examples, please refer to **[Examples](#-Examples  \"Examples\")**.\n\n\u003cbr\u003e\n\n## 📓 Documentation\n\nGo to **[THIS LINK](http://github.com/arhcoder/Pytomatas/blob/master/docs/automatas.md \"THIS LINK\")** to see the documentation on all the features of the different types of automata, the functions they have, and examples of their implementation.\n\n\u003cbr\u003e\n\n## 📚 Examples\n\n1. **[DFA (Deterministic Finite Automaton)](https://github.com/arhcoder/Pytomatas/blob/master/docs/dfa.md  \"DFA\").**\n\n2. **[NFA (Non-deterministic Finite Automaton)](https://github.com/arhcoder/Pytomatas/blob/master/docs/nfa.md \"NFA\").**\n\n3. **[PDA (Push-Down Automaton)](https://github.com/arhcoder/Pytomatas/blob/master/docs/pda.md \"PDA\").**\n\n4. **[TM (Turing Machine)](https://github.com/arhcoder/Pytomatas/blob/master/docs/tm.md \"TM\").**\n\n5. **[Safebox Automata Implementation Project](https://github.com/arhcoder/Pytomatas/blob/master/docs/xsafebox.md).**\n\n\u003cbr\u003e\n\n## 📁 Repository\n\nGo to **[THIS LINK](https://github.com/arhcoder/Pytomatas)** to check out the source code.\n\n\u003cbr\u003e\n\n## ✍ Contributing\n\nContributions are welcome! If you encounter any issues, have suggestions, or would like to contribute to the project, please feel free to open an issue or submit a pull request on **[this repository](https://github.com/arhcoder/Pytomatas)**.\n\n\u003cbr\u003e\n\n## 📜 License\n\nThis project is licensed under the MIT License - see the **[LICENSE](https://github.com/arhcoder/Pytomatas/blob/master/LICENSE)** file for details.\n\n\u003chr\u003e\n\n**Made with 💜 by @arhcoder**;\n\n\u003cbr\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farhcoder%2Fpytomatas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farhcoder%2Fpytomatas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farhcoder%2Fpytomatas/lists"}