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