blob: c0aaec6ade4787b856f9c8fdaa48b5f0e5f924b6 (
plain)
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
|
(;module:
lux
(lux (control monad)
(data text/format
(coll [list "L/" Functor<List>]))
[macro #+ Monad<Lux>])
(luxc ["&" base]
(lang ["la" analysis #+ Analysis]
["ls" synthesis #+ Synthesis])
["&;" analyser]))
(def: #export (synthesize analysis)
(-> Analysis Synthesis)
(case analysis
(^template [<from> <to>]
[meta (<from> value)]
(<to> value))
([#la;Unit #ls;Unit]
[#la;Bool #ls;Bool]
[#la;Nat #ls;Nat]
[#la;Int #ls;Int]
[#la;Deg #ls;Deg]
[#la;Real #ls;Real]
[#la;Char #ls;Char]
[#la;Text #ls;Text]
[#la;Relative #ls;Relative]
[#la;Absolute #ls;Absolute])
[meta (#la;Tuple values)]
(#ls;Tuple (L/map synthesize values))
[meta (#la;Variant tag last? value)]
(#ls;Variant tag last? (synthesize value))
[meta (#la;Function scope body)]
(#ls;Function scope (synthesize body))
[meta (#la;Call func args)]
(#ls;Call (synthesize func) (L/map synthesize args))
[meta (#la;Procedure name args)]
(#ls;Procedure name (L/map synthesize args))
[meta (#la;Case pattern)]
(undefined)))
|