Convert regular expressions to minimized DFAs in AT&T FST format
Project description
regex2dfa
Convert regular expressions to minimized DFAs in AT&T FST format.
Pure Python · Zero dependencies · Results cached in memory
Installation
pip install regex2dfa
Usage
from regex2dfa import regex2dfa
dfa = regex2dfa("(a|b)+")
print(dfa)
Output:
0 1 97 97
0 1 98 98
1 1 97 97
1 1 98 98
1
Features
- Pure Python — No external dependencies
- Fast — Results cached with LRU (1024 entries)
- Complete pipeline — Thompson's → Subset → Hopcroft minimization
Supported Syntax
| Feature | Syntax | Example |
|---|---|---|
| Literal | a |
abc |
| Any char | . |
a.b |
| Character class | [abc], [a-z], [^abc] |
[0-9]+ |
| Quantifiers | *, +, ? |
a*, b+, c? |
| Alternation | | |
cat|dog |
| Grouping | (...) |
(ab)+ |
| Escapes | \x00, \d, \w, \s, \C |
\xFF, \d+ |
Output Format
AT&T FST format with tab-separated fields:
- Transitions:
src dst input output - Final states:
state_id
Labels are ASCII byte values (e.g., 97 = 'a').
Links
License
MIT
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 regex2dfa-0.2.1.tar.gz.
File metadata
- Download URL: regex2dfa-0.2.1.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a82092ec04f7caa0216b9590c0fee7ee1b30337ce4ea6aeb9b6e7a46477c6e4
|
|
| MD5 |
1674ff1542dd40f95171b87eb3148809
|
|
| BLAKE2b-256 |
b5d15179e614d91f1c8da08a1bb9835612afbc4f5a1c95a9e855fa2683e2e4c8
|
Provenance
The following attestation bundles were made for regex2dfa-0.2.1.tar.gz:
Publisher:
publish.yml on kpdyer/regex2dfa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
regex2dfa-0.2.1.tar.gz -
Subject digest:
4a82092ec04f7caa0216b9590c0fee7ee1b30337ce4ea6aeb9b6e7a46477c6e4 - Sigstore transparency entry: 813341174
- Sigstore integration time:
-
Permalink:
kpdyer/regex2dfa@f98535171db19a4c8bd382570955b7e67ba49211 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/kpdyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f98535171db19a4c8bd382570955b7e67ba49211 -
Trigger Event:
release
-
Statement type:
File details
Details for the file regex2dfa-0.2.1-py3-none-any.whl.
File metadata
- Download URL: regex2dfa-0.2.1-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb225c630efeb6bf4bc4769e211e4923f63f81c5ba0b365ae887d167eaa9f463
|
|
| MD5 |
3f8dc6b8b718ed38174a58e976c71868
|
|
| BLAKE2b-256 |
a35312bc28e1c4edb7c3209883c16c0d54ab03b048bec4b392b3dd2500ce2c0e
|
Provenance
The following attestation bundles were made for regex2dfa-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on kpdyer/regex2dfa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
regex2dfa-0.2.1-py3-none-any.whl -
Subject digest:
eb225c630efeb6bf4bc4769e211e4923f63f81c5ba0b365ae887d167eaa9f463 - Sigstore transparency entry: 813341182
- Sigstore integration time:
-
Permalink:
kpdyer/regex2dfa@f98535171db19a4c8bd382570955b7e67ba49211 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/kpdyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f98535171db19a4c8bd382570955b7e67ba49211 -
Trigger Event:
release
-
Statement type: