]> Git — Sourcephile - haskell/symantic-parser.git/blob - symantic-parser.cabal
set cabal category to Parsing (like megaparsec)
[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 author: Julien Moutinho <julm+symantic-parser@sourcephile.fr>
59 maintainer: Julien Moutinho <julm+symantic-parser@sourcephile.fr>
60 bug-reports: Julien Moutinho <julm+symantic-parser@sourcephile.fr>
61 copyright: Julien Moutinho <julm+symantic-parser@sourcephile.fr>
62 stability: experimental
63 category: Parsing
64 extra-source-files:
65 extra-tmp-files:
66 build-type: Simple
67 tested-with: GHC==9.0.1
68
69 source-repository head
70 type: git
71 location: git://git.sourcephile.fr/haskell/symantic-parser
72
73 flag dump-core
74 description: Dump GHC's Core in HTML
75 default: False
76
77 common boilerplate
78 default-language: Haskell2010
79 default-extensions:
80 BangPatterns,
81 DataKinds,
82 FlexibleContexts,
83 FlexibleInstances,
84 GADTs,
85 GeneralizedNewtypeDeriving,
86 LambdaCase,
87 MultiParamTypeClasses,
88 NamedFieldPuns,
89 NoImplicitPrelude,
90 RankNTypes,
91 RecordWildCards,
92 ScopedTypeVariables,
93 TypeApplications,
94 TypeFamilies,
95 TypeOperators
96 ghc-options:
97 -Wall
98 -Wincomplete-uni-patterns
99 -Wincomplete-record-updates
100 -fhide-source-paths
101 -freverse-errors
102 -ddump-splices
103 -ddump-to-file
104
105 library
106 import: boilerplate
107 hs-source-dirs: src
108 exposed-modules:
109 Symantic.Univariant.Letable
110 Symantic.Univariant.Trans
111 Symantic.Parser
112 Symantic.Parser.Grammar
113 Symantic.Parser.Grammar.Combinators
114 Symantic.Parser.Grammar.Dump
115 Symantic.Parser.Grammar.Fixity
116 Symantic.Parser.Grammar.ObserveSharing
117 Symantic.Parser.Grammar.Optimize
118 Symantic.Parser.Grammar.Write
119 Symantic.Parser.Haskell
120 Symantic.Parser.Machine
121 Symantic.Parser.Machine.Dump
122 Symantic.Parser.Machine.Generate
123 Symantic.Parser.Machine.Input
124 Symantic.Parser.Machine.Instructions
125 build-depends:
126 base >=4.10 && <5,
127 array,
128 bytestring,
129 containers,
130 ghc-prim,
131 hashable,
132 parallel,
133 template-haskell >= 2.16,
134 text,
135 transformers,
136 unordered-containers
137
138 test-suite symantic-parser-test
139 import: boilerplate
140 type: exitcode-stdio-1.0
141 hs-source-dirs: test
142 main-is: Main.hs
143 other-modules:
144 Golden
145 Golden.Grammar
146 -- Golden.Utils
147 -- Golden.Parsers
148 -- HUnit
149 -- QuickCheck
150 default-extensions:
151 ViewPatterns
152 ghc-options:
153 build-depends:
154 symantic-parser,
155 base >= 4.10 && < 5,
156 bytestring >= 0.10,
157 containers >= 0.5,
158 deepseq >= 1.4,
159 directory >= 1.3,
160 filepath >= 1.4,
161 hashable >= 1.2.6,
162 process >= 1.6,
163 strict >= 0.4,
164 tasty >= 0.11,
165 tasty-golden >= 2.3,
166 -- tasty-hunit,
167 template-haskell >= 2.16,
168 -- temporary >= 1.3,
169 text >= 1.2,
170 -- time >= 1.9,
171 transformers >= 0.4,
172 -- QuickCheck >= 2.0,
173 -- tasty-quickcheck,
174 unix >= 2.7,
175 unordered-containers
176 if flag(dump-core)
177 build-depends: dump-core
178 ghc-options: -fplugin=DumpCore