Skip to main content

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

frontend_for_free-0.3-py3-none-any.whl (24.8 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