blob: 76b206124d591f3fa872a286a579f493bef085f3 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
(.module:
[lux #*
[control
[monad (#+ do)]]]
[//
[runtime (#+ Phase)]
["." primitive]
["." structure]
["." reference]
["." function]
["." case]
["." loop]
["." ///
["." synthesis]
["." extension]]])
(def: #export (translate synthesis)
Phase
(case synthesis
(^template [<tag> <generator>]
(^ (<tag> value))
(:: ///.monad wrap (<generator> value)))
([synthesis.bit primitive.bit]
[synthesis.i64 primitive.i64]
[synthesis.f64 primitive.f64]
[synthesis.text primitive.text])
(^ (synthesis.variant variantS))
(structure.variant translate variantS)
(^ (synthesis.tuple members))
(structure.tuple translate members)
(#synthesis.Reference value)
(:: reference.system reference value)
(^ (synthesis.branch/case case))
(case.case translate case)
(^ (synthesis.branch/let let))
(case.let translate let)
(^ (synthesis.branch/if if))
(case.if translate if)
(^ (synthesis.loop/scope scope))
(loop.scope translate scope)
(^ (synthesis.loop/recur updates))
(loop.recur translate updates)
(^ (synthesis.function/abstraction abstraction))
(function.function translate abstraction)
(^ (synthesis.function/apply application))
(function.apply translate application)
(#synthesis.Extension extension)
(extension.apply translate extension)))
|