Skip to main content

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

This version

0.2

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 hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page