symantic-parser: Parser combinators statically optimized and staged via typed meta-programming

[ agpl, library, parsing ] [ Propose Tags ] [ Report a vulnerability ]

This is a work-in-progress experimental library to generate parsers, leveraging Tagless-Final interpreters and Typed Template Haskell staging.

This is an alternative but less powerful/reviewed implementation of ParsleyHaskell. See the paper by Jamie Willis, Nicolas Wu, and Matthew Pickering, admirably well presented at ICFP-2020: Staged Selective Parser Combinators.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
dump-core

Dump GHC's Core in HTML

Disabled
dump-splices

Dump code generated by Template Haskell

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.0.20210101, 0.0.0.20210102, 0.1.0.20210201, 0.2.0.20210703, 0.2.1.20210803
Change log ChangeLog.md
Dependencies array, base (>=4.10 && <5), bytestring, containers, ghc-prim, hashable, template-haskell (>=2.16), text, transformers, unordered-containers [details]
Tested with ghc ==9.0.0
License GPL-3.0-or-later
Copyright Julien Moutinho <julm+symantic-parser@sourcephile.fr>
Author Julien Moutinho <julm+symantic-parser@sourcephile.fr>
Maintainer Julien Moutinho <julm+symantic-parser@sourcephile.fr>
Category Parsing
Bug tracker Julien Moutinho <julm+symantic-parser@sourcephile.fr>
Source repo head: git clone git://git.sourcephile.fr/haskell/symantic-parser
Uploaded by julm at 2021-01-02T01:50:34Z
Distributions
Downloads 551 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for symantic-parser-0.0.0.20210102

[back to package description]

Main differences with respect to ParsleyHaskell

  • Tagless-final and DefaultSignatures are used instead of tagfull-final to handle recursion schemes, this avoids constructing and deconstructing as much tags when transforming combinators or instructions. And structures/simplifies the code by avoiding to define custom traversals (traverseCombinator) or custom fix-point data-types (Fix4) and associated utilities (cata4) when introducing new index-types. Note that the extensibility of combinators, a great feature of tagless-final, is not really achievable when using the optimizing pass which requires a comprehensive initial encoding.

  • No dependency on dependent-map by keeping observed sharing inside def and ref combinators, instead of passing by a DMap. Same for join-points, where TemplateHaskell names are also directly used instead of passing by a DMap.

  • No dependency on GHC plugins: lift-plugin and idioms-plugin, because those are plugins hence introduce a bit of complexity in the build processes using this parser, but most importantly they are experimental and only cosmetic, since they only enable a cleaner usage of the parsing combinators, by lifting Haskell code in pure to integrate the TemplateHaskell needed. I do not understand them that much and do not feel confortable to maintain them in case their authors abandon them.

  • Error messages based upon the farthest input position reached (not yet implemented in ParsleyHaskell).

  • License is GPL-3.0-or-later not BSD-3-Clause.

Main goals

  • For me to better understand ParsleyHaskell, and find a manageable balance between simplicity of the codebase and features of the parser.

  • To support parsing tree-like data structures (like XML or HTTP routes) instead of just string-like data structures, which I've done using megaparsec, but it is not conceived for such input, and is less principled when it comes to optimizing, like merging alternatives.