BNFC-meta: Deriving Parsers and Quasi-Quoters from BNF Grammars

[ development, gpl, language, library, parsing, text ] [ Propose Tags ] [ Report a vulnerability ]

This package provides a very simple way of defining a compiler front-end for a language by embedding a BNF grammar directly into a Haskell source file. Specifically, given a quasi-quoted LBNF grammar (as used by the BNF Converter) it generates (using Template Haskell) a LALR parser and pretty pretty printer for the language. The parser is then used to automatically define a quasi-quoter for the defined language so it can also be seamlessly embedded in Haskell source code. With a simple addition to the gramwmar, the user can define a universal syntax for anti-quoting. This means that any grammar non-terminal can be replaced by a quoted Haskell expression of the appropriate type. A few example languages are included in the source tarball.

The LBNF grammar formalism is described thoroughly in the BNF Converter documentation: http://bnfc.digitalgrammars.com/

This library and the additions it makes to LBNF is described in a 2011 Haskell Symposium paper titled "Embedded Parser Generators": http://wiki.portal.chalmers.se/cse/pmwiki.php/FP/EmbeddedParserGenerators

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.2, 0.2.0.1, 0.2.0.2, 0.2.1, 0.2.2, 0.3, 0.3.0.1, 0.3.0.2, 0.3.0.3, 0.3.0.4, 0.3.0.5, 0.4, 0.4.0.1, 0.4.0.2, 0.4.0.3, 0.5, 0.6, 0.6.1
Dependencies alex-meta (>=0.3.0.5 && <0.4), array (>=0.4 && <0.6), base (>=4.2 && <5), fail (>=4.9 && <5), happy-meta (>=0.2.0.4 && <0.3), haskell-src-meta (>=0.5 && <1.0), syb (>=0.2 && <1.0), template-haskell (>=2.12 && <3) [details]
License GPL-2.0-only
Author Jonas Duregård
Maintainer Artem Pelenitsyn <artem.pelenitsyn@gmail.com>
Revised Revision 5 made by ArtemPelenitsyn at 2023-02-24T04:50:54Z
Category Development, parsing, text, language
Source repo head: git clone https://github.com/ulysses4ever/BNFC-meta(BNFC-meta)
Uploaded by ArtemPelenitsyn at 2020-02-09T23:44:05Z
Distributions LTSHaskell:0.6.1, NixOS:0.6.1, Stackage:0.6.1
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 22521 total (92 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-02-10 [all 1 reports]