Typed BNF
Given a grammar:
shape token {
lexeme : str
}
polyrule : <a> <b> { fn (a) -> ($1.lexeme, $2, a) }
polyrule2 : <a> polyrule { fn (a) -> $2(a) }
We type inference it:
polyrule : forall 'a. ('a) -> (str, token, 'a)
polyrule2 : forall 'a. ('a) -> (str, token, 'a)
Then we can lower it to a BNF grammar used by other parser framework, no matter which programming language is the target.
Backends
Tentatively, support for python-lark and antlr-java are down. Focusing on improving antlr-csharp(So far C# has no easy-to-use parser generator.)
python -m tbnf GRAMMAR.tbnf [lark|csharp|antlr] [--outdir OUTDIR=.] [--mod MODULENAME=mylang]
Metadata
Release files for tbnf 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tbnf-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / tbnf-0.2-py3-none-any.whl
| Download URL | tbnf-0.2-py3-none-any.whl |
|---|---|
| Size | 65.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
751b24a8a8eea4cb30ad2e5c8ab946248d4796f0efdcfa98982209ca1b4c5bd4
|
|
BLAKE2b-256 checksum How to use checksums |
ac24276cc26b6ab8f2204042db2462c3f4df7ad36495cda946ba1bb9acc5c713
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
|