Skip to content

Commit fbe3cb3

Browse files
committed
migration from the legacy to the new architecture
1 parent 3f9e7ca commit fbe3cb3

42 files changed

Lines changed: 1186 additions & 115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.11'
18+
19+
- name: Install project
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -e .[dev]
23+
24+
- name: Run tests
25+
run: pytest -q

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*.pyo
5+
*.pyd
6+
*.so
7+
8+
# Virtual environments
9+
.venv/
10+
venv/
11+
env/
12+
13+
# IDE
14+
.idea/
15+
.vscode/
16+
17+
# OS
18+
.DS_Store
19+
Thumbs.db
20+
21+
# Pytest / coverage
22+
.pytest_cache/
23+
.coverage
24+
htmlcov/
25+
26+
# Build
27+
build/
28+
dist/
29+
*.egg-info/
30+
31+
# Local outputs
32+
data/processed/
33+
reports/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Mathieu Alassoeur
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 128 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,63 @@
11
# Automata Toolkit
22

3-
A Python toolkit for reading, validating, transforming, and testing finite automata from text-based definitions.
3+
A Python toolkit for parsing, validating, transforming, and testing finite automata from text-based definitions.
44

55
## Project Overview
66

7-
Automata Toolkit is a command-line application designed to manipulate finite automata from a simple input format. It supports core operations from automata theory such as standardization, determinism checks, completion, complement construction, and word recognition.
7+
Automata Toolkit is a command-line application designed to manipulate finite automata from a simple text input format. It supports key automata-theory operations such as property validation, standardization, completion, complement construction, word recognition, and deterministic minimization.
88

9-
The project was originally inspired by an academic formal-languages assignment and has been redesigned as a clean, testable software-engineering project focused on algorithmic correctness, reproducibility, and maintainability.
9+
The project started from an academic formal-languages assignment and is restructured here as a clean software-engineering project focused on algorithmic correctness, maintainability, reproducibility, and portfolio quality.
1010

1111
## Problem Statement
1212

13-
Finite automata exercises are often solved manually or with ad hoc scripts that are hard to verify, extend, or demonstrate. This project provides a structured engine to:
13+
Finite automata exercises are often solved manually or through monolithic scripts that are hard to verify, extend, test, or demonstrate. This project provides a structured engine that can:
1414

15-
- load automata from text files,
15+
- ingest automata definitions from text files,
1616
- validate structural properties,
1717
- apply formal transformations,
18-
- test word recognition,
19-
- produce readable transition tables and visual exports.
18+
- test input words,
19+
- generate readable console output,
20+
- export JSON and Graphviz-compatible DOT representations.
2021

2122
## Features
2223

23-
- Load automata from `.txt` files
24-
- Display states, alphabet, initial/final states, and transition tables
24+
- Parse automata from `.txt` files
25+
- Validate automaton integrity
2526
- Check whether an automaton is:
26-
- standard
27-
- deterministic
27+
- standard,
28+
- deterministic,
2829
- complete
29-
- Standardize a non-standard automaton
30-
- Determinize and complete a non-deterministic automaton
31-
- Minimize a deterministic complete automaton
32-
- Recognize user-provided words
30+
- Standardize an automaton
31+
- Determinize an automaton
32+
- Complete an automaton with a sink state
3333
- Build the complementary automaton
34-
- Export automata to Graphviz / JSON
35-
- Run automated tests on reference automata
34+
- Minimize a deterministic complete automaton
35+
- Recognize words from the automaton language
36+
- Export to JSON
37+
- Export to DOT / Graphviz format
38+
- Run automated tests on the parser, validators, transformations, recognition logic, and CLI workflows
3639

3740
## Tech Stack
3841

39-
- **Python**
40-
- **pytest** for testing
41-
- **Typer** or **argparse** for CLI
42-
- **Graphviz** for diagram export
42+
- **Python 3.10+**
43+
- **argparse** for the CLI
44+
- **pytest** for automated testing
4345
- **GitHub Actions** for CI
46+
- **DOT / Graphviz** export for diagrams
4447

4548
## Architecture
4649

47-
The codebase is organized into five layers:
48-
49-
- `domain/` → automaton model and core entities
50-
- `parsers/` → input file parsing
51-
- `validators/` → property checks
52-
- `services/` → automata transformations
53-
- `renderers/` → console, JSON, and graph exports
50+
```text
51+
src/automata_toolkit/
52+
├── domain/ # core automaton model
53+
├── parsers/ # file parsing and DTOs
54+
├── validators/ # formal property and integrity checks
55+
├── services/ # transformations and recognition logic
56+
├── renderers/ # console / JSON / DOT outputs
57+
└── cli/ # command-line entrypoint
58+
```
5459

55-
This separation keeps the project easier to test, maintain, and extend.
60+
This separation keeps the project easier to test, document, and extend.
5661

5762
## Installation
5863

@@ -62,108 +67,116 @@ cd automata-toolkit
6267
python -m venv .venv
6368
source .venv/bin/activate
6469
pip install -e .[dev]
65-
Usage
66-
Run the CLI
67-
python -m automata_toolkit.cli.main
68-
Example workflow
69-
python -m automata_toolkit.cli.main \
70-
--input data/raw/efrei_test_cases/BDX4-08.txt \
71-
--check-all \
72-
--determinize \
73-
--complete \
74-
--recognize aab
75-
Example output
76-
Automaton loaded successfully
77-
States: [0, 1, 2, 3]
78-
Alphabet: [a, b]
79-
Initial states: [0]
80-
Final states: [3]
81-
82-
Properties:
83-
- Standard: No
84-
- Deterministic: No
85-
- Complete: No
86-
87-
Actions performed:
88-
- Standardization: applied
89-
- Determinization: applied
90-
- Completion: applied
91-
92-
Word recognition:
93-
- aab -> accepted
94-
Example Results
95-
96-
The toolkit can be used to:
97-
98-
validate a full batch of reference automata,
99-
100-
compare original and transformed versions,
101-
102-
generate deterministic and minimized forms,
103-
104-
document algorithm behavior for teaching or demonstrations.
105-
106-
Screenshots
107-
Suggested screenshots to add
108-
109-
CLI overview
110-
111-
Load an automaton and print its transition table
70+
```
11271

113-
Property checks
72+
## Input File Format
11473

115-
Show standard / deterministic / complete results
74+
Example:
11675

117-
Transformation result
76+
```text
77+
states: q0,q1,q2
78+
alphabet: a,b
79+
initial_states: q0
80+
final_states: q2
81+
transitions:
82+
q0,a,q1
83+
q0,b,q0
84+
q1,a,q2
85+
q1,b,q1
86+
q2,a,q2
87+
q2,b,q2
88+
```
11889

119-
Show original automaton vs determinized/complete version
90+
## Usage
12091

121-
Graph export
92+
### Run the CLI
12293

123-
Render the transformed automaton as a diagram
124-
125-
Test report
126-
127-
Show passing unit tests and integration tests
128-
129-
Project Structure
130-
src/automata_toolkit/
131-
data/raw/efrei_test_cases/
132-
tests/
133-
docs/
134-
assets/
135-
Future Improvements
136-
137-
Add epsilon-transition support with explicit closure computation
138-
139-
Add batch processing for all test automata
94+
```bash
95+
automata-cli --input data/raw/efrei_test_cases/sample_automaton.txt --check-all
96+
```
14097

141-
Add JSON schema validation for input/output formats
98+
### Determinize and export to DOT
14299

143-
Add web UI for educational visualization
100+
```bash
101+
automata-cli \
102+
--input data/raw/efrei_test_cases/sample_automaton.txt \
103+
--determinize \
104+
--complete \
105+
--export-dot assets/diagrams/sample.dot
106+
```
144107

145-
Add complexity analysis and performance benchmarks
108+
### Recognize a word
146109

147-
Add export of minimization steps and partition evolution
110+
```bash
111+
automata-cli \
112+
--input data/raw/efrei_test_cases/sample_automaton.txt \
113+
--word aab
114+
```
148115

149-
Limitations
116+
## Example Output / Results
150117

151-
The current implementation targets educational finite automata workflows
118+
```text
119+
Automaton loaded successfully.
152120
153-
Input format is constrained to the project specification
121+
States: q0, q1, q2
122+
Alphabet: a, b
123+
Initial states: q0
124+
Final states: q2
154125
155-
Advanced regex conversion features are not yet included
126+
Properties
127+
- Integrity: valid
128+
- Standard: yes
129+
- Deterministic: yes
130+
- Complete: yes
156131
157-
Why this project matters
132+
Word recognition
133+
- aab -> accepted
134+
```
135+
136+
## Screenshots
137+
138+
Suggested screenshots to add in `assets/screenshots/`:
139+
140+
1. **CLI overview**
141+
- Load an automaton and print its transition table.
142+
2. **Property checks**
143+
- Show integrity, standardness, determinism, and completeness results.
144+
3. **Transformation result**
145+
- Compare original automaton vs determinized / completed / minimized version.
146+
4. **DOT / graph export**
147+
- Render the transformed automaton visually.
148+
5. **CI proof**
149+
- Show a successful GitHub Actions pipeline.
150+
151+
## Project Structure
152+
153+
```text
154+
automata-toolkit/
155+
├── src/
156+
├── data/
157+
├── tests/
158+
├── docs/
159+
├── assets/
160+
└── scripts/
161+
```
162+
163+
## Future Improvements
164+
165+
- Add epsilon-transition support
166+
- Add batch processing for all EFREI test cases
167+
- Add HTML report generation for before/after comparisons
168+
- Add performance benchmarks for determinization and minimization
169+
- Add richer validation diagnostics with line-level parser errors
170+
- Add a small educational web UI for visualization
171+
172+
## Why This Project Matters
158173

159174
This repository demonstrates:
160175

161-
algorithm implementation,
162-
163-
CLI software design,
164-
165-
parser + transformation architecture,
166-
167-
test-driven validation of formal systems.
176+
- algorithm implementation,
177+
- clean CLI software design,
178+
- parser and transformation architecture,
179+
- automated testing,
180+
- reproducible engineering practices.
168181

169-
It is intended as a strong software-engineering complement to a portfolio centered on data, BI, and analytics projects.
182+
It is intended as a strong software-engineering complement to a portfolio centered on Data / BI / Analytics Engineering projects.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"sample_automaton.txt": true
3+
}

data/expected/minimized_cases.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sample_automaton.txt": {
3+
"expected_state_count": 3
4+
}
5+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"sample_automaton.txt": {
3+
"a": false,
4+
"aa": true,
5+
"aab": true,
6+
"b": false
7+
}
8+
}

0 commit comments

Comments
 (0)