-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
66 lines (52 loc) · 2.72 KB
/
notes.txt
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
The general change to the grammar looks like the following:
NEW:
options ::= { <id> = <id> (, <id> = <id>)* }
plugins ::= <id> [<options>] (, <id> [<options>])*
MODIFIED:
exp ::= ...
| [ .<id>: <tyident> [<options>]]
typdesc ::= ...
| <typdesc> [ [.deriving <plugins>] ]
datdesc ::= ...
| <datdesc> [ [.deriving <plugins>] ]
gonna need one for datatype replication too... ugh
dec ::= ...
| TYPE <typbinds> [ [.deriving <plugins> ] ]
| DATATYPE <datbinds> [<withtypee>] [ [.deriving <plugins>] ]
gonna need one for datatype replication here too
- [x] add parsing support for [.deriving] on typdescs, datdescs, typedecs, datdecs
- [ ] add parsing support for [.deriving] on datrepls
- [X] add parsing support for [.show: ...] expressions
- [X] revamp `transform` structure
NOTE: maybe not possible... `transform` needs to work at a higher
granularity, since decs may be expanded into more than just one dec.
For now, hardcoded on `spec` and `dec`.
- [X] add codegen for show
- [X] add codegen for eq
- [X] add codegen for ord
- [X] add codegen for map
- [X] add parsing support for NJ-extensions (or-patterns, functor sugar)
- [X] add ability to derive all files in an SML project from CM
- [X] add error messages
- The parser we're using (from mlc) was never intended for altering source text.
- This parser was meant to be used for a compiler, meaning that it strips down
some of the literal syntactic information for equivalent semantic information.
- In particular, something like `op+ (1, 2)` is represented the same as `1 + 2`.
- This means that recovering the original program is impossible.
- As such, we're constrained so that `deriving` should work "invisibly", and not
show anything that it generates. Granted, this is how OCaml's works too, so
maybe it's fine.
- currently, we're zeroing out location data with absurd because code insertion
fucks literally everything up
- it's possible that we can alter the tokens to be more friendly by making
tokens work "relationally", and store offsets from nearby tokens, as opposed
to exact data
- It would be nice if derive expressions gave error messages for improper usage.
- For instance, you could have an error for:
1) invalid number of tyargs (e.g. `[.show: (int, int) option]`)
2) nonexistent types (e.g. `[.show: type_which_doesnt_exist]`)
- The first way is dependent on knowing the arity of type constructors at
parse time, which is perhaps impossible without very significant overhaul.
- The second way is to have an extra `Ederive` variant, and push back derive
expression rewriting to transform time. This will also necessitate that
`Context`s store modular scope information.