Statically typed BNF with semantic actions; A frontend of frontend frameworks; Use your grammar everywhere.

Overview

Typed BNF

Given a grammar:

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.

Lark Backend

python -m tbnf GRAMMAR.tbnf lark [--outdir OUTDIR=.] [--mod MODULENAME=mylang]  

Antlr Backend

python -m tbnf GRAMMAR.tbnf antlr [--outdir OUTDIR=.] [--mod MODULENAME=mylang]  
You might also like...
This is a repository containing the backend and the frontend of a simple pokédex.

Pokémon This is a repository containing the backend and the frontend of a simple pokédex. This is a work in progress project! Project Structure 🗂 pok

apysc is the Python frontend library to create html and js file, that has ActionScript 3 (as3)-like interface.
apysc is the Python frontend library to create html and js file, that has ActionScript 3 (as3)-like interface.

apysc apysc is the Python frontend library to create HTML and js files, that has ActionScript 3 (as3)-like interface. Notes: Currently developing and

We'll be using HTML, CSS and JavaScript for the frontend

We'll be using HTML, CSS and JavaScript for the frontend. Nothing to install in specific. Open your text-editor and start coding a beautiful front-end.

This repo houses the qhub frontend moving forward.

This repo houses the qhub frontend moving forward. This effort will house a backend written in fastAPI, and a fronend in Vue, with additional components.

Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends.
Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends.

Quiz Application Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends. When they would a

The earliest beta version of pytgcalls on Linux x86_64 and ARM64! Use in production at your own risk!

Public beta test. Use in production at your own risk! tgcalls - a python binding for tgcalls (c++ lib by Telegram); pytgcalls - library connecting pyt

Automatically give thanks to Pypi packages you use in your project!

Automatically give thanks to Pypi packages you use in your project!

🟥This is an overview of how to set up and use DataStore3 in your Roblox experiences

Welcome to DataStore3 👋 This is an overview of how to set up and use DataStore3 in your Roblox experiences What is it? 🤔 DataStore3 is a service tha

Simple AoC helper program you can use to develop your own solutions in python.

AoC-Compabion Simple AoC helper program you can use to develop your own solutions in python. Simply install it in your python environment using pip fr

Comments
  •  use `A` for type parameters instead of `'A`

    use `A` for type parameters instead of `'A`

    This is because we want to support single quote literals such as 'x'. So far we use ANTLR backends to implement the metaparser(parser for Typed BNF itself), which makes it hard for us to achieve contextual lexing.

    opened by thautwarm 0
  • dependencies of lexer definition

    dependencies of lexer definition

    For antlr-csharp backend, such lexer rules work:

    <int> : DIGIT+
    <DIGIT> : [0 .. 9]
    

    <int> can be defined before presenting <DIGIT>, however, this will cause a compile error in ocaml-menhir+sedlex backend:

    let rule_INT_5 = [%sedlex.regexp? Plus (rule_DIGIT_4)]
    let rule_DIGIT_4 = [%sedlex.regexp? ('0' .. '9')]
    

    It's easy to resolve this order but I don't think it deserve a high priority.

    opened by thautwarm 0
Releases(0.2)
  • 0.2(Aug 7, 2022)

    > node tbnf.js  ./runtests/simple_json.tbnf -o ./runtests/julia_simple_json -lang "simple_json" -be julia-fff
    
    > node tbnf.js --help
    usage: tbnf.js [-h] [-o OUTDIR] [-lang LANGUAGE]
                   [-be {python-lark,ocaml-menhir,csharp-antlr,typescript-antlr,julia-fff,purebnf}]
                   [-conf CONFIGPATH]
                   tbnfSourcePath
    
    positional arguments:
      tbnfSourcePath
    
    optional arguments:
      -h, --help            show this help message and exit
      -o OUTDIR, --outDir OUTDIR
      -lang LANGUAGE, --language LANGUAGE
                            name of your own language
      -be {python-lark,ocaml-menhir,csharp-antlr,typescript-antlr,julia-fff,purebnf}, --backend {python-lark,ocaml-menhir,csharp-antlr,typescript-antlr,julia-fff,purebnf}
      -conf CONFIGPATH, --configPath CONFIGPATH
                            path to a config file
    
    Source code(tar.gz)
    Source code(zip)
    tbnf-linux(38.72 MB)
    tbnf-macos(44.25 MB)
    tbnf-win.exe(32.57 MB)
    tbnf.js(2.08 MB)
Owner
Taine Zhao
Taine Zhao
Mail Me My Social Media stats (SoMeMailMe)

Mail Me My Social Media follower count (SoMeMailMe) TikTok only show data 60 days back in time. With this repo you can easily scrape your follower cou

Daniel Wigh 1 Jan 07, 2022
Blender pluggin (python script) that adds a randomly generated tree with random branches and bend orientations

Blender pluggin (python script) that adds a randomly generated tree with random branches and bend orientations

Travis Gruber 2 Dec 24, 2021
Projeto para ajudar no aprendizado da linguagem Pyhon

Economize Este projeto tem o intuito de criar desáfios para a codificação em Python, fazendo com que haja um maior entendimento da linguagem em seu to

Lucas Cunha Rodrigues 1 Dec 16, 2021
little proyect to organize myself, but maybe can help someone else

TaskXT 0.1 Little proyect to organize myself, but maybe can help someone else Idea The main idea is to ogranize you work and stuff to do, but with onl

Gabriel Carmona 4 Oct 03, 2021
B-Pkg is a simple tool in python for installing all basic package in termux

Basic-Pkg 👉🏻 Basic-Pkg 👈🏻 B-Pkg is a simple tool in python for installing all basic package in termux This is my first tool, I hope you will like

Macgaiver 3 Oct 21, 2021
Writeup of NilbinSec's participation in the Winja CTF for c0c0n 2021

Winja-CTF-c0c0n-2021-Writeup NilbinSec's participation in the Winja CTF for c0c0n 2021 This repo covers NilbinSec's participation in the Winja CTF dur

1 Nov 15, 2021
WMIC Serial Checker For Python

WMIC Serial Checker Follow me here: Discord | Github FR: A but éducatif seulement. EN: For educational purposes only. ❓ Informations FR: WMIC Serial C

AkaTool's 0 Apr 25, 2022
Basic cryptography done in Python for study purposes

criptografia Criptografia básica feita em Python para fins de estudo Converte letras em numeros partindo do indice 0 e vice-versa A criptografia é fei

Carlos Eduardo 2 Dec 05, 2021
VCM EE1.2 P-layer feature map anchor generation 137th MPEG-VCM

VCM EE1.2 P-layer feature map anchor generation 137th MPEG-VCM

IPSL 6 Oct 18, 2022
Helps to arrange nodes

Relax brush for nodes, helps to arrange nodes easier.

336 Dec 15, 2022
The LiberaPay archive module for the SeanPM life archive project.

By: Top README.md Read this article in a different language Sorted by: A-Z Sorting options unavailable ( af Afrikaans Afrikaans | sq Shqiptare Albania

Sean P. Myrick V19.1.7.2 1 Aug 26, 2022
This is a library to do functional programming in Python.

Fpylib This is a library to do functional programming in Python. Index Fpylib Index Features Intelligents Ranges with irange Lazyness to functions Com

Fabián Vega Alcota 4 Jul 17, 2022
An extended version of the hotkeys demo code using action classes

An extended version of the hotkeys application using action classes. In adafruit's Hotkeys code, a macro is using a series of integers, assumed to be

Neradoc 5 May 01, 2022
Oppia is an online learning tool that enables anyone to easily create and share interactive activities

Oppia is an online learning tool that enables anyone to easily create and share interactive activities (called 'explorations'). These activities simulate a one-on-one conversation with a tutor, makin

Oppia 4.7k Dec 29, 2022
UdemyPy is a bot that hourly looks for Udemy free courses and post them in my Telegram Channel: Free Courses.

UdemyPy UdemyPy is a bot that hourly looks for Udemy free courses and post them in my Telegram Channel: Free Courses. How does it work? For publishing

88 Dec 25, 2022
🛠️ Plugin to integrate Chuy with Poetry

Archived This is bundled with Chuy since v1.3.0. Poetry Chuy Plugin This plugin integrates Chuy with Poetry. Note: This only works in Poetry 1.2.0 or

Eliaz Bobadilla 4 Sep 24, 2021
A wrapper script to make working with ADB (Android Debug Bridge) easier

Python-ADB-Wrapper A wrapper script to make working with ADB (Android Debug Bridge) easier This project was just a simple test to see if I could wrap

18iteration 1 Nov 25, 2021
A software dedicated to automaticaly select the agent of your desire in Valorant

AUTOPICKER A software dedicated to automaticaly select the agent of your desire in Valorant GUIDE Before stariting to use this program check if you ha

p1n00 0 Sep 24, 2022
Vaksina - Vaksina COVID QR Validation Checker With Python

Vaksina COVID QR Validation Checker Vaksina is a general purpose library intende

Michael Casadevall 33 Aug 20, 2022
A simple and efficient computing package for Genshin Impact gacha analysis

GGanalysisLite计算包 这个版本的计算包追求计算速度,而GGanalysis包有着更多计算功能。 GGanalysisLite包通过卷积计算分布列,通过FFT和快速幂加速卷积计算。 测试玩家得到的排名值rank的数学意义是:与抽了同样数量五星的其他玩家相比,测试玩家花费的抽数大于等于比例

一棵平衡树 34 Nov 26, 2022