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
プレヤフHackUチーム「キャット・タン」が作成したアプリ「illustection」

cat_tongue_illustection プレヤフHackUチーム「キャット・タン」が作成した, プライバシー保護アプリ「illustection」です! デモ動画 https://youtu.be/z3I7LuB_i58 機能 アップロードされた画像をいい感じのイラストやの素材に置き換える(

4 Jul 03, 2021
A python script to search for k-uniform Euclidean tilings.

k-uniform-solver A python script to search for k-uniform Euclidean tilings. This project's aim is to replicate and extend the list of k-uniform Euclid

3 Dec 06, 2022
Plugin to manage site, circuit and device diagrams and documents in Netbox

Netbox Documents Plugin A plugin designed to faciliate the storage of site, circuit and device specific documents within NetBox Note: Netbox v3.2+ is

Jason Yates 38 Dec 24, 2022
Defichain maxi - Scripts to optimize performance on defichain rewards

defichain_maxi This script is made to optimize your defichain vault rewards by m

kuegi 75 Dec 31, 2022
Demo of a WAM Prolog implementation in Python

Prol: WAM demo This is a simplified Warren Abstract Machine (WAM) implementation for Prolog, that showcases the main instructions, compiling, register

Bruno Kim Medeiros Cesar 62 Dec 26, 2022
Just RESTing

petnica-api-workshop Just RESTing Setup Using pipenv You can setup this project with pipenv if you want isolated libraries. After you've installed pip

Aleksa Tešić 1 Oct 23, 2021
Explore related sequences in the OEIS

OEIS explorer This is a tool for exploring two different kinds of relationships between sequences in the OEIS: mentions (links) of other sequences on

Alex Hall 6 Mar 15, 2022
A basic tool to generate Hydrogen drum machine kits.

Generate Hydrogen Kit A basic tool to generate drumkit.xml files for Hydrogen drum machine. Saves a bit of time when making kits. Supply it with a nam

Luna Langton 2 Nov 28, 2021
Buggy script to play with GPOs

GPOwned /!\ This is a buggy PoC I made just to play with GPOs in my lab. Don't use it in production! /!\ The script uses impacket and ldap3 to update

45 Dec 15, 2022
poro is a LCU interface to change some lol's options.

poro is a LCU interface to change some lol's options. with this program you can: change your profile icon change your profiel background image ch

João Dematte 2 Jan 05, 2022
Custom Python code for calculating the Probability of Profit (POP) for options trading strategies using Monte Carlo Simulations.

Custom Python code for calculating the Probability of Profit (POP) for options trading strategies using Monte Carlo Simulations.

35 Nov 22, 2022
Table (Finnish Taulukko) glued together to transform into hands-free living.

taulukko Table (Finnish Taulukko) glued together to transform into hands-free living. Installation Preferred way to install is as usual (for testing o

Stefan Hagen 2 Dec 14, 2022
Repository for DNN training, theory to practice, part of the Large Scale Machine Learning class at Mines Paritech

DNN Training, from theory to practice This repository is complementary to the deep learning training lesson given to les Mines ParisTech on the 11th o

Alexandre Défossez 6 Nov 14, 2022
Easy installer for running Amazon AVS Device SDK on Raspberry Pi

avs-device-sdk-pi Scripts to enable Alexa voice activation using Picovoice Porcupine If you like the work, find it useful and if you would like to get

4 Nov 14, 2022
A python tool that creates issues in your repos based on TODO comments in your code

Krypto A neat little sidekick python script to create issues on your repo based on comments left in the code on your behalf Convert todo comments in y

Alex Antoniou 4 Oct 26, 2021
Odoo modules related to website/webshop

Website Apps related to Odoo it's website/webshop features: webshop_public_prices: allow configuring to hide or show product prices and add to cart bu

Yenthe Van Ginneken 9 Nov 04, 2022
0CD - BinaryNinja plugin to introduce some quality of life utilities for obsessive compulsive CTF enthusiasts

0CD Author: b0bb Quality of life utilities for obsessive compulsive CTF enthusia

12 Sep 14, 2022
Back-end API for the reternal framework

RE:TERNAL RE:TERNAL is a centralised purple team simulation platform. Reternal uses agents installed on a simulation network to execute various known

Joey Dreijer 7 Apr 15, 2022
Fofa asset consolidation script

资产收集+C段整理二合一 基于fofa资产搜索引擎进行资产收集,快速检索目标条件下的IP,URL以及标题,适用于资产较多时对模糊资产的快速检索,新增C段整理功能,整理出

白泽Sec安全实验室 36 Dec 01, 2022
PaintPrint - This module can colorize any text in your terminal

PaintPrint This module can colorize any text in your terminal Author: tankalxat3

Alexander Podstrechnyy 2 Feb 17, 2022