A Python CLI for DFA, NFA, PDA, and CFG simulation
Project description
Automata-Toolbox
Overview
Automata Toolbox is a Python framework designed for simulating various types of automata used in computational theory. It supports the following automata types:
- Deterministic Finite Automata (DFA)
- Non-Deterministic Finite Automata (NFA)
- Pushdown Automata (PDA)
- Context-Free Grammar (CFG)
This framework allows users to define and execute automata using structured configuration files or Python classes. It provides utilities for parsing, validation, and simulation of automata, making it an ideal tool for learning and experimentation.
Features
✅ Full Automata Simulation - Supports DFA, NFA, PDA, and CFG.
✅ Structured Configuration - Automata are defined using .cfg configuration files.
✅ Python API - Automata can be created and run programmatically.
✅ Command-Line Interface (CLI) - Automata can be managed directly from the terminal.
✅ Extensible and Modular - Designed to be modified and extended easily.
Installation
Automata Toolbox requires Python 3.7+. Install it via pip:
pip install automata_toolbox
Alternatively, you can install it from source:
git clone https://github.com/Cris24dc/Automata-Toolbox.git
cd Automata-Toolbox
pip install -e .
CLI Usage
Generate an Automaton Template
automata generate dfa my_dfa
Supported automaton types: dfa, nfa, pda, cfg.
Run a DFA on an Input String
python3 -m toolbox.main config/my_dfa.cfg abba
Using the Python API
Creating and Running a DFA
from toolbox import DFA
dfa = DFA("config/example.cfg")
if dfa.is_valid():
print("DFA is valid")
print(dfa.run("abba"))
Using an NFA
from toolbox import NFA
nfa = NFA("config/example_nfa.cfg")
if nfa.is_valid():
print("NFA is valid")
print(nfa.run("abba"))
Configuration Files
Each automaton type requires a .cfg file structured as follows:
DFA Configuration Example
[Sigma]
a
b
end
[States]
q0
q1
end
[Start]
q0
end
[Final]
q1
end
[Delta]
q0 a q1
q1 b q0
end
CFG Configuration Example
[Variables]
S
end
[Terminals]
a
b
end
[Rules]
S -> aSb
S -> $
end
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file automata_toolbox-2.0.tar.gz.
File metadata
- Download URL: automata_toolbox-2.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
deaf4121ec513309e0158a96a747292b7be99b42938f22c3a349ffc76818d7d1
|
|
| MD5 |
c78627cb223f6fc597d7efad84f01b60
|
|
| BLAKE2b-256 |
a812acc99612cdba1139c9740cddbeee9b183ea71d5fcfe886bef719f3ed460c
|
File details
Details for the file automata_toolbox-2.0-py3-none-any.whl.
File metadata
- Download URL: automata_toolbox-2.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2244928cd100338a20b2764511ca8b104122fb54534568b20df51ec99503e2b8
|
|
| MD5 |
ba2e56fc83efb2630fe03e3299ecfde2
|
|
| BLAKE2b-256 |
3888ce78e0c9d8af2978a4f2da79110f7ddb0e20dbccdee30440843048a4ab0b
|