gll: GLL parser with simple combinator interface
GLL is a parser combinator library for writing generalised parsers. The user can write parsers for arbitrary context-free grammars, including both non-determinism and all forms of left and right-recursion. The underlying parsing algorithm is GLL (Scott and Johnstone 2013).
The library provides an interface in Control.Applicative
style:
it uses the combinators <*>
, <|>
, <$>
and derivations.
With <$>
arbitrary semantic actions are added to the parser.
Four functions can be used to run a parser: parse
, parseString
,
parseWithOptions
and parseStringWithOptions
.
Function parse
relies on the builtin Token
datatype, receiving a list of
Token
as an input string. User-defined token-types are currently not supported.
Function *parseString* enables parsing character-level parsing.
The result of aparse is a list of semantic results, one result for each derivation.
To avoid infinite recursion, only 'good parse trees' are considered (Ridge 2014).
To limit the number of accepted derivation, and therefore avoiding potential
exponential blow-up, GLL.Combinators.Options
are available to specify certain
disambiguation rules.
GLL.Combinators.MemInterface
is a memoised version of the library.
Memoisation is used to speed up the process of applying semantic actions,
it is not necessary for generalised parsing:
GLL.Combinators.Interface
and GLL.Combinators.MemInterface
are
equally general.
In the memoised version, parsers are no longer pure functions and must be
developed inside the IO monad.
Examples can be found in the GLL.Combinators.Test
directory.
Modules
[Index]
Downloads
- gll-0.2.0.3.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Versions [RSS] | 0.1.0.0, 0.1.0.1, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.2.0.3, 0.3.0.0, 0.3.0.1, 0.3.0.6, 0.3.0.7, 0.3.0.9, 0.3.0.10, 0.4.0.2, 0.4.0.3, 0.4.0.4, 0.4.0.5, 0.4.0.11, 0.4.0.12, 0.4.0.13, 0.4.1.0, 0.4.1.1 (info) |
---|---|
Dependencies | array, base (>=4.5 && <=4.8.0.0), containers (>=0.4), TypeCompose [details] |
Tested with | ghc ==7.6.3 |
License | BSD-3-Clause |
Author | L. Thomas van Binsbergen |
Maintainer | ltvanbinsbergen@acm.org |
Category | Compilers |
Uploaded | by ltvanbinsbergen at 2015-06-06T11:24:41Z |
Distributions | NixOS:0.4.1.1 |
Reverse Dependencies | 4 direct, 0 indirect [details] |
Downloads | 11454 total (4 in the last 30 days) |
Rating | 2.0 (votes: 1) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2015-06-09 [all 1 reports] |