@hackage symantic-parser0.0.0.20210101

Parser combinators statically optimized and staged via typed meta-programming

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.