blob: f795a2980cb43667a439dbc9b403f99a1cbffe49 (
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
|
(;module:
lux
(lux (control monad)
(data text/format)
[meta "meta/" Monad<Meta>])
(luxc ["&" base]
[";L" host]
(host ["$" jvm]
(jvm ["$i" inst]
["$t" type]))
(lang ["la" analysis]
["ls" synthesis]
(translation [";T" common])))
[../runtime])
(def: #export translate-unit
(Meta $;Inst)
(meta/wrap ($i;string hostL;unit)))
(def: #export (translate-bool value)
(-> Bool (Meta $;Inst))
(meta/wrap ($i;GETSTATIC "java.lang.Boolean"
(if value "TRUE" "FALSE")
($t;class "java.lang.Boolean" (list)))))
(do-template [<name> <type> <load> <wrap>]
[(def: #export (<name> value)
(-> <type> (Meta $;Inst))
(meta/wrap (|>. (<load> value) <wrap>)))]
[translate-nat Nat (|>. (:! Int) $i;long) ($i;wrap #$;Long)]
[translate-int Int $i;long ($i;wrap #$;Long)]
[translate-deg Deg (|>. (:! Int) $i;long) ($i;wrap #$;Long)]
[translate-frac Frac $i;double ($i;wrap #$;Double)]
[translate-text Text $i;string id]
)
|