blob: bb90b0cdf32dcfb915b6122ddb62caa3739a8607 (
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
60
61
62
63
64
65
66
67
68
69
|
(.module:
[lux #*
[abstract
[monad (#+ do)]]
[control
["." io (#+ IO)]]
[data
["." error (#+ Error)]]
[tool
[compiler
["." synthesis (#+ Synthesis)]
["." statement]
["." phase
["." macro (#+ Expander)]
["." generation (#+ Operation Bundle)]
[extension
["." bundle]]]
[default
["." platform (#+ Platform)]]]]])
(type: #export Runner (-> Text Synthesis (Error Any)))
(type: #export Definer (-> Name Synthesis (Error Any)))
(def: #export (runner platform bundle expander program)
(All [anchor expression statement]
(-> (Platform IO anchor expression statement)
(Bundle anchor expression statement)
Expander
(-> expression statement)
Runner))
(function (_ evaluation-name expressionS)
(io.run
(do io.monad
[?state (platform.initialize expander platform bundle program)]
(wrap (do error.monad
[[bundle' state] ?state
expressionG (<| (phase.run (get@ [#statement.generation
#statement.state]
state))
(do phase.monad
[_ (get@ #platform.runtime platform)]
((get@ #platform.phase platform) expressionS)))]
(:: (get@ #platform.host platform) evaluate! evaluation-name
expressionG)))))
))
## (def: #export (runner generate-runtime translate bundle state)
## (-> (Operation Any) Phase Bundle (IO State)
## Runner)
## (function (_ valueS)
## (|> (do phase.Monad<Operation>
## [_ generate-runtime
## program (translate valueS)]
## (translation.evaluate! "runner" program))
## translation.with-buffer
## (phase.run [bundle (io.run state)]))))
## (def: #export (definer generate-runtime translate bundle state)
## (-> (Operation Any) Phase Bundle (IO State) Definer)
## (function (_ lux-name valueS)
## (|> (do phase.Monad<Operation>
## [_ generate-runtime
## valueH (translate valueS)
## [host-name host-value] (translation.define! lux-name valueH)
## _ (translation.learn lux-name host-name)
## program (translate (synthesis.constant lux-name))]
## (translation.evaluate! "definer" program))
## translation.with-buffer
## (phase.run [bundle (io.run state)]))))
|