forked from JakeWheat/hssqlppp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo
245 lines (177 loc) · 8.08 KB
/
todo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
= next release, 0.5.0
see bigplan for some details
review and fix some of the syntax?
start thinking about how to support both postgresql and sql server better
maybe stick with postgresql as guide for abstract syntax
add bits from sql server where they don't have a parallel in postgres
add a flag to only parse postgres or sql server constructs
add a flag to pretty print in postgres or sql server
maybe add a syntax check to check an ast value is valid
- this check could cover a bunch of other things which are
syntactically possible because of the design of the ast types,
but don't represent valid concrete syntax
idea for :: cast
-> parse typenames as scalarexpressions by embeddeding them in
numberlits (hacky but should be unambiguous)
then transform to cast after parsing. This can then use the proper
precedence in buildExpressionParser to parse ::. Also produce parse
errors if after parsing, you try to cast to something which isn't a
typename
= 'arcs'
== names
the typechecker ignores the new name structure which is able to
syntactically distinguish quoted identifiers and schema names
alter some of the catalog data types and support functions to work on
names or namecomponents instead of strings: mainly in the catalog and
local binding stuff
== localenv
New approach to fixupidentifiers in IDEnv. Want to use this approach
for typechecking local identifiers. Also can have more control over
rewriting the syntax. At the moment, it always adds in aliases and
correlation names all over the place. Want to make this optional, and
the ability to only add correlation names and not aliases. Want to
also get rid of the separate fixupidentifiers pass.
== typesafe wrapper
write typesafe wrapper for haskell accessing database big question is
which record system to use: haskell records, hlists, haskelldb
records, maybe fc-labels?
nullability inference would be useful here, also possibly single
column in result specialisation, and static check of single tuple in
result (e.g. where on key, or non grouped aggregates).
== api
review api names, docs and other aspects
== website nav
== examples
add compilation of examples to automated tests, also add tests in the
documentation
== nullablity inference in type checker
== syntax refactoring
lots of messy bits in the syntax:
some renames - try to follow the sql standard reference better
split out the plpgsql statements to separate ast node
have parens explicit in the ast?
more faithful representation of source code? This is mainly for
defaults, e.g. can't tell after parsing if an order by element was
explicitly asc, or implicitly asc. This might be useful for lint
checking e.g..
== ag - review code add fixmes
review ag code (and other code?) add fixme notes
== ag - literal source and haskell syntax
change the ag code to use .lag, and to use the haskell syntax
option. This should make understanding the code much more simple. One
possible goal to work towards is to make the main ast source file look
just like haskell, and to be able to edit it as if it was
haskell. This may need an additional codegenerator for compiling to
add in the ag boilerplate.
== ag - typechecking flow
the ag attributes and flow between sem rules is a bit confused at the
moment. In particular want to remove the extra 'inferred type'
annotation, also want to remove the cycles reported by uuagc by being
a bit more regular and disciplined (the cycles don't seem to have
caused any real issues however).
== typechecking regressions fix
lots of disabled tests, get them all passing again
== chaos
work on the chaos example
* get it typechecking OK again - lots of work on typechecker needed
* get the unit tests running again: maybe quickest is to port to new haskelldb
* get the ui running again so you can actually see it running
* maybe port these over to hssqlppp typesafe access for dogfooding
* fix the documentation generator which shows the translated sql -
fair few prerequisites to this
* use new custom syntax stuff
* use the sql documentation generator (from the catalog)
add parsing and typechecking chaos (+ others?) to automated tests
== doctool
get the standalone doctool working. Get the website documentation
generator working again
== h7c
work on the functionality. want to get it working as a library to
compile chaos without needing to look at the hssqlppp lib
internals. The main blocker is fixing the syntax and then exposing the
parser internals for extension use.
== catalog work
the catalog holds pretty limited information at the moment, and
doesn't use that information to type check ddl very well (e.g. reject
drop on non existent objects, don't allow two tables with same name,
etc.)
so
* add much better error checking
* add much more information to support error checking
* track more types of objects, e.g. triggers, indexes
* add more information to support documentation generator, e.g. view
source, function source, cross-linked hypertext sources
== quasiquote work
in addition to fixing the anticonstructor hiding above, want to add a
lot more quasiquotes. Good start would be to review all the
extensions, and translation examples, codegen, etc.. and make sure you
never need to write asts out explicitly, and can always use
quasiquotes.
Another thing to add is full haskell syntax inside quasiquotes. No
idea how to do this but the language-c-quote package does this so can
look at the source there.
== refactoring
review the code and refactor the crufty bits. Also want much better
documentation in the .lhs. Main code to completely rewrite is
TypeConversion.lhs which was written when I didn't know haskell very
well.
== error handling
review to eliminate any errors being hidden, or calls to 'error'
== custom syntax plugins
want to be able to plugin new syntax into parser - so alter syntax
tree as well. maybe start with the ability to add new statement types,
and new expressions types only.
== work through pg manual to get more complete coverage of sql syntax
== roundtrip testing
use postgresql to help with testing:
parse ddl, get catalog
load sql into postgresql, read catalog from pg
compare
dump database, parse dump and check catalog from hssqlppp is the same
parse sql
load into postgresql
dump
parse again
check is equivalent (might be very hard in general case)
some quickcheck style testing:
generate random ast
(maybe stick to scalar expression to start with?)
typecheck with hssqlppp
load into postgresql and get type out
check types are the same
== report generator
the idea is to have the following for experimentation, evaluate how
well hssqlppp supports some existing sql, support while developing
sql (possibly with syntax extensions), and generating
documentation:
take source sql:
standard postgresql sql in text files
sql taken from postgresql dump from live db
syntax extended sql in text files
do some or all of the following:
parse and type check - report problems
parse, pretty print, reparse and check
generate documentation, catalog
load into postgresql and double check catalog from typechecker
load and dump postgresql, reparse and typecheck for changes
== documentation generator for sql codebases
== fix operator parsing
fix expression parsing and custom operators: stage one is to do a hack
which supplies the parser with the operator details at run time so
there is some flexibility
full dynamic support: e.g. create operators in sql then able to parse
use of them ... standard way of dealing with operator precedence is to
parse them all as left associative then adjust the tree after, not
sure this will be enough -> perhaps can reuse the haskell-src-exts
fixity thing for rewriting trees - will have to add parens explicitly
to the ast and parser, which might be tricky for sql?
== write extensions?
materialized view, temporal data, generalized inclusions, order
independent ddl source, show used catalog, modules for sql source
== lint
lint tool framework - so want to make it easy to add new rules
== separate parse tree?
consider having separate parse tree to the ast - can this be
automatic, or should it be a 'fake' parse tree
== better annotation approach?
maybe try to parameterize on annotation type? lots of other techniques