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