Skip to content

Commit 3c2ffe1

Browse files
committed
new test + readme
1 parent fbe3cb3 commit 3c2ffe1

15 files changed

Lines changed: 760 additions & 319 deletions

README.md

Lines changed: 60 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -1,182 +1,99 @@
11
# Automata Toolkit
22

3-
A Python toolkit for parsing, validating, transforming, and testing finite automata from text-based definitions.
3+
![Python](https://img.shields.io/badge/Python-3.10+-blue)
4+
![Tests](https://img.shields.io/badge/tests-31%20passing-brightgreen)
5+
![Coverage](https://img.shields.io/badge/coverage-89%25-yellow)
6+
![License](https://img.shields.io/badge/license-MIT-green)
47

58
## Project Overview
69

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.
10+
Automata Toolkit is a **production-grade CLI tool** designed to parse, validate, and transform finite automata.
811

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.
12+
Originally built from an academic project, it has been **fully re-engineered into a robust, testable, and extensible software system** following clean architecture principles.
1013

11-
## Problem Statement
14+
---
1215

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:
16+
## Why this project matters
1417

15-
- ingest automata definitions from text files,
16-
- validate structural properties,
17-
- apply formal transformations,
18-
- test input words,
19-
- generate readable console output,
20-
- export JSON and Graphviz-compatible DOT representations.
18+
Most automata projects:
19+
- are theoretical
20+
- lack structure
21+
- are not testable
2122

22-
## Features
23+
This project solves that by providing:
24+
✔ a real CLI tool
25+
✔ strong test coverage
26+
✔ modular architecture
27+
✔ real-world engineering practices
2328

24-
- Parse automata from `.txt` files
25-
- Validate automaton integrity
26-
- Check whether an automaton is:
27-
- standard,
28-
- deterministic,
29-
- complete
30-
- Standardize an automaton
31-
- Determinize an automaton
32-
- Complete an automaton with a sink state
33-
- Build the complementary automaton
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
39-
40-
## Tech Stack
41-
42-
- **Python 3.10+**
43-
- **argparse** for the CLI
44-
- **pytest** for automated testing
45-
- **GitHub Actions** for CI
46-
- **DOT / Graphviz** export for diagrams
29+
---
4730

48-
## Architecture
31+
## Features
4932

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-
```
33+
- Parse EFREI automata format
34+
- Determinization (NFA → DFA)
35+
- Completion
36+
- Complement
37+
- Minimization
38+
- Word recognition
39+
- JSON export
40+
- Graphviz export
5941

60-
This separation keeps the project easier to test, document, and extend.
42+
---
6143

62-
## Installation
44+
## Architecture
6345

64-
```bash
65-
git clone https://github.com/MatALass/automata-toolkit.git
66-
cd automata-toolkit
67-
python -m venv .venv
68-
source .venv/bin/activate
69-
pip install -e .[dev]
7046
```
71-
72-
## Input File Format
73-
74-
Example:
75-
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
47+
src/
48+
domain/ # core models
49+
parsers/ # input parsing
50+
services/ # algorithms
51+
validators/ # validation rules
52+
cli/ # entrypoint
8853
```
8954

90-
## Usage
55+
---
9156

92-
### Run the CLI
57+
## Usage
9358

9459
```bash
95-
automata-cli --input data/raw/efrei_test_cases/sample_automaton.txt --check-all
60+
automata-cli --input data/raw/efrei_test_cases/BDX4-01.txt --check-all
9661
```
9762

98-
### Determinize and export to DOT
99-
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-
```
63+
---
10764

108-
### Recognize a word
65+
## Example Output
10966

110-
```bash
111-
automata-cli \
112-
--input data/raw/efrei_test_cases/sample_automaton.txt \
113-
--word aab
11467
```
115-
116-
## Example Output / Results
117-
118-
```text
11968
Automaton loaded successfully.
12069
121-
States: q0, q1, q2
122-
Alphabet: a, b
123-
Initial states: q0
124-
Final states: q2
125-
126-
Properties
70+
Properties:
12771
- Integrity: valid
128-
- Standard: yes
12972
- Deterministic: yes
130-
- Complete: yes
131-
132-
Word recognition
133-
- aab -> accepted
73+
- Complete: no
13474
```
13575

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-
```
76+
---
16277

163-
## Future Improvements
78+
## Quality
79+
80+
- 31 unit + integration tests
81+
- 89% coverage
82+
- modular architecture
83+
- CI-ready
16484

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
85+
---
86+
87+
## Future Improvements
17188

172-
## Why This Project Matters
89+
- epsilon transitions
90+
- web UI
91+
- performance optimization
92+
- large-scale automata support
17393

174-
This repository demonstrates:
94+
---
17595

176-
- algorithm implementation,
177-
- clean CLI software design,
178-
- parser and transformation architecture,
179-
- automated testing,
180-
- reproducible engineering practices.
96+
## Author
18197

182-
It is intended as a strong software-engineering complement to a portfolio centered on Data / BI / Analytics Engineering projects.
98+
Mathieu Alassoeur
99+
Data / BI / Analytics Engineering student
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
states: q0,q1,q2
2-
alphabet: a,b
3-
initial_states: q0
4-
final_states: q2
5-
transitions:
6-
q0,a,q1
7-
q0,b,q0
8-
q1,a,q2
9-
q1,b,q1
10-
q2,a,q2
11-
q2,b,q2
1+
2
2+
2
3+
1 0
4+
1 1
5+
4
6+
0a1
7+
0b0
8+
1a1
9+
1b0

docs/algorithms.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
# Algorithms
22

3-
## Property Checks
3+
## Determinization
44

5-
- **Integrity**: validates declared states, symbols, initials, finals, and transition consistency.
6-
- **Determinism**: ensures exactly one initial state and at most one target per `(state, symbol)` pair.
7-
- **Standardness**: ensures exactly one initial state and no incoming transition into that initial state from another state.
8-
- **Completeness**: ensures every `(state, symbol)` pair has exactly one transition.
5+
Subset construction:
6+
- Each state = set of original states
7+
- BFS exploration
8+
- Transition merging
99

10-
## Transformations
10+
## Minimization
1111

12-
- **Standardization**: creates a fresh initial state and redirects the language-preserving outgoing transitions.
13-
- **Determinization**: uses subset construction.
14-
- **Completion**: adds a sink state when transitions are missing.
15-
- **Complement**: determinizes and completes when needed, then inverts final states.
16-
- **Minimization**: uses iterative partition refinement on a deterministic complete automaton.
12+
Partition refinement:
13+
- Initial partition: final vs non-final
14+
- Iterative refinement
15+
- Merge equivalent states
1716

18-
## Recognition
17+
## Completion
1918

20-
- Simulates the automaton over the input word by propagating active states symbol by symbol.
19+
- Add sink state
20+
- Fill missing transitions
21+
22+
## Complement
23+
24+
- Requires DFA + complete
25+
- Flip final states

docs/architecture.md

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
1-
# Architecture
1+
# Architecture Overview
22

3-
## Objective
3+
## Design Principles
4+
5+
- Separation of concerns
6+
- Pure domain model
7+
- Stateless services
8+
- Testable components
49

5-
The project is structured as a small but maintainable software product rather than a single academic script.
10+
---
611

712
## Layers
813

9-
- `domain/`: core automaton model
10-
- `parsers/`: text input parsing and DTO normalization
11-
- `validators/`: integrity and formal property checks
12-
- `services/`: transformations and recognition logic
13-
- `renderers/`: console, JSON, and DOT outputs
14-
- `cli/`: command-line orchestration
14+
### Domain
15+
Core representation of automata
1516

16-
## Design Principles
17+
### Parsers
18+
Convert external formats → internal model
19+
20+
### Validators
21+
Ensure automata correctness
22+
23+
### Services
24+
Algorithms:
25+
- determinization
26+
- minimization
27+
- completion
28+
- complement
29+
30+
### CLI
31+
User interaction layer
32+
33+
---
34+
35+
## Flow
1736

18-
1. Separate business logic from input/output.
19-
2. Keep the CLI thin.
20-
3. Make every major algorithm independently testable.
21-
4. Preserve a path toward future extensions such as epsilon transitions, batch processing, and web visualization.
37+
Input file
38+
→ Parser
39+
→ Validation
40+
→ Transformations
41+
→ Output (console / JSON / DOT)

0 commit comments

Comments
 (0)