No project description provided
Project description
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]
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
tbnf-0.2-py3-none-any.whl
(65.0 kB
view details)
File details
Details for the file tbnf-0.2-py3-none-any.whl
.
File metadata
- Download URL: tbnf-0.2-py3-none-any.whl
- Upload date:
- Size: 65.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 751b24a8a8eea4cb30ad2e5c8ab946248d4796f0efdcfa98982209ca1b4c5bd4 |
|
MD5 | 2959ba854b4b9a944078913b70c1cc88 |
|
BLAKE2b-256 | ac24276cc26b6ab8f2204042db2462c3f4df7ad36495cda946ba1bb9acc5c713 |