Statically generating standablone regex-based lexers and highly optimized LL(k) parsers
Project description
Frontend-For-Free
A bootstrap of RBNF.hs for generating standalone parsers targeting multiple programming languages, where the generated code needs no runtime system.
Installation
Binary files
You can install binary files via The Haskell Tool Stack.
sh> stack install .
Otherwise, so far Windows binary files are released on GitHub.
Download it from Releases, add fff-lex
and fff-pgen
to your PATH.
Python Wrapper
frontend-for-free
now supports Python only:
pip install frontend-for-free
or install it from GitHub.
Usage
sh> fff <xxx>.rbnf --trace # note that you should also provide a <xxx>.rlex
sh> ls | grep <xxx>
<xxx>_parser.py <xxx>_lex.py
See examples at runtest.
What is Frontend-For-Free?
A framework for generating context-free parsers with following properties:
- cross-language
- distributed with a lexer generator, but feel free to use your own lexers.
- LL(k) capability
- efficient left recursions
- standalone No 3rd party library is introduced, while the generator requires Python3.6+ with a few dependencies.
- defined with a most intuitive and expressive BNF derivative
-
action/rewrite:
pair := a b { ($1, $2) }
-
parameterised polymorphisms for productions:
nonEmpty[A] := A { [$1] } | hd=A tl=nonEmpty[A] { append(hd, tl) }
where
append
shall be provided by the user code.
-
Currently,
- the parser generator support for a programming language is hard coded in
src/RBNF/BackEnds/<LanguageName>.hs
. - the lexer generator support for a programming language is hard coded in
ffflex.py
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for frontend_for_free-0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8aba5b05e6641f831d8b8d520a7d41768e1b8bcb5f45671048a90fea86a6306 |
|
MD5 | fc47b7c29afa206a0c3a5ae1510c15bf |
|
BLAKE2b-256 | 25bfee7a729469cf4f7fcde88162da18eb35550f9c802a4c88727d0a2433ffe4 |