]> Git — Sourcephile - haskell/symantic-parser.git/blob - symantic-parser.cabal
polishing before first publising
[haskell/symantic-parser.git] / symantic-parser.cabal
1 cabal-version: 2.2
2 name: symantic-parser
3 version: 0.0.0.20210101
4 synopsis: Parser combinators statically optimized and staged via typed meta-programming
5 description:
6 This is a work-in-progress experimental library to generate parsers,
7 leveraging Tagless-Final interpreters and Typed Template Haskell staging.
8 .
9 This is an alternative but less powerful/reviewed
10 implementation of [ParsleyHaskell](https://github.com/J-mie6/ParsleyHaskell).
11 See the paper by Jamie Willis, Nicolas Wu, and Matthew
12 Pickering, admirably well presented at ICFP-2020: [Staged
13 Selective Parser
14 Combinators](https://icfp20.sigplan.org/details/icfp-2020-papers/20/Staged-Selective-Parser-Combinators).
15 .
16 Main differences are:
17 .
18 * Tagless-final and DefaultSignatures are used
19 instead of tagfull-final to handle recursion schemes,
20 this avoids constructing and deconstructing as much tags when transforming
21 combinators or instructions.
22 And structures/simplifies the code by avoiding to define
23 custom traversals (traverseCombinator)
24 or custom fix-point data-types (Fix4)
25 and associated utilities (cata4) when introducing new index-types.
26 Note that the extensibility of combinators, a great feature of tagless-final,
27 is not really achievable when using the optimizing pass
28 which requires a comprehensive initial encoding.
29 * No dependency on dependant-map by keeping observed sharing
30 inside 'def' and 'ref' combinators, instead of passing by a DependantMap.
31 * No dependency on GHC plugins: lift-plugin and idioms-plugin,
32 because those are plugins hence introduce a bit of complexity
33 in the build process, but most importantly they are experimental
34 and only cosmetic, since they only enable a cleaner usage
35 of the parsing combinators, by lifting Haskell code in 'pure'
36 to integrate the TemplateHaskell needed.
37 I do not understand them (yet) and do not feel confortable
38 to maintain them in case their authors abandon them.
39 * Error messages based upon the farthest input position reached (not yet implemented in Parsley).
40 * License is GPL-3.0-or-later not BSD-3-Clause.
41 .
42 Goals are:
43 .
44 * For me to understand ParsleyHaskell, and find a manageable balance
45 between simplicity of the codebase and features of the parser.
46 * To support parsing tree-like data structures (like XML or HTTP routes)
47 instead of just string-like data structures,
48 which is doable with megaparsec, but is hard and less principled
49 when it comes to optimizing, like merging alternatives.
50 .
51 TODO:
52 .
53 * Factorize input size checks (like Parsley's piggy bank).
54 * Error messages also based upon: [A Parsing Machine for Parsing Expression Grammars with Labeled Failures](https://dl.acm.org/doi/10.1145/2851613.2851750)
55 * Registers?
56 license: GPL-3.0-or-later
57 author: Julien Moutinho <julm+symantic-parser@sourcephile.fr>
58 maintainer: Julien Moutinho <julm+symantic-parser@sourcephile.fr>
59 bug-reports: Julien Moutinho <julm+symantic-parser@sourcephile.fr>
60 copyright: Julien Moutinho <julm+symantic-parser@sourcephile.fr>
61 stability: experimental
62 category: Parsing
63 extra-source-files:
64 .envrc
65 Makefile
66 cabal.project
67 default.nix
68 flake.nix
69 shell.nix
70 extra-tmp-files:
71 build-type: Simple
72 tested-with: GHC==9.0.0
73
74 source-repository head
75 type: git
76 location: git://git.sourcephile.fr/haskell/symantic-parser
77
78 flag dump-core
79 description: Dump GHC's Core in HTML
80 manual: True
81 default: False
82
83 flag dump-splices
84 description: Dump code generated by Template Haskell
85 manual: True
86 default: False
87
88 common boilerplate
89 default-language: Haskell2010
90 default-extensions:
91 BangPatterns,
92 DataKinds,
93 FlexibleContexts,
94 FlexibleInstances,
95 GADTs,
96 GeneralizedNewtypeDeriving,
97 LambdaCase,
98 MultiParamTypeClasses,
99 NamedFieldPuns,
100 NoImplicitPrelude,
101 RankNTypes,
102 RecordWildCards,
103 ScopedTypeVariables,
104 TypeApplications,
105 TypeFamilies,
106 TypeOperators
107 ghc-options:
108 -Wall
109 -Wincomplete-uni-patterns
110 -Wincomplete-record-updates
111 -fhide-source-paths
112 -freverse-errors
113
114 library
115 import: boilerplate
116 hs-source-dirs: src
117 exposed-modules:
118 Symantic.Univariant.Letable
119 Symantic.Univariant.Trans
120 Symantic.Parser
121 Symantic.Parser.Grammar
122 Symantic.Parser.Grammar.Combinators
123 Symantic.Parser.Grammar.Dump
124 Symantic.Parser.Grammar.Fixity
125 Symantic.Parser.Grammar.ObserveSharing
126 Symantic.Parser.Grammar.Optimize
127 Symantic.Parser.Grammar.Write
128 Symantic.Parser.Haskell
129 Symantic.Parser.Machine
130 Symantic.Parser.Machine.Dump
131 Symantic.Parser.Machine.Generate
132 Symantic.Parser.Machine.Input
133 Symantic.Parser.Machine.Instructions
134 build-depends:
135 base >=4.10 && <5,
136 array,
137 bytestring,
138 containers,
139 ghc-prim,
140 hashable,
141 template-haskell >= 2.16,
142 text,
143 transformers,
144 unordered-containers
145
146 test-suite symantic-parser-test
147 import: boilerplate
148 type: exitcode-stdio-1.0
149 hs-source-dirs: test
150 main-is: Main.hs
151 other-modules:
152 Golden
153 Golden.Grammar
154 -- Golden.Utils
155 -- Golden.Parsers
156 -- HUnit
157 -- QuickCheck
158 default-extensions:
159 ViewPatterns
160 ghc-options:
161 build-depends:
162 symantic-parser,
163 base >= 4.10 && < 5,
164 bytestring >= 0.10,
165 containers >= 0.5,
166 deepseq >= 1.4,
167 directory >= 1.3,
168 filepath >= 1.4,
169 hashable >= 1.2.6,
170 process >= 1.6,
171 strict >= 0.4,
172 tasty >= 0.11,
173 tasty-golden >= 2.3,
174 -- tasty-hunit,
175 template-haskell >= 2.16,
176 -- temporary >= 1.3,
177 text >= 1.2,
178 -- time >= 1.9,
179 transformers >= 0.4,
180 -- QuickCheck >= 2.0,
181 -- tasty-quickcheck,
182 unix >= 2.7,
183 unordered-containers
184 if flag(dump-core)
185 build-depends: dump-core
186 ghc-options: -fplugin=DumpCore
187 if flag(dump-splices)
188 ghc-options:
189 -ddump-splices
190 -ddump-to-file