aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler.lux
blob: e151c9e9411eaa35d751e211caf53187bb308fde (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
(.module:
  [lux (#- Module Source Code)
   [control
    ["ex" exception (#+ exception:)]]
   [data
    ["." error (#+ Error)]
    [collection
     ["." dictionary (#+ Dictionary)]]]
   [world
    ["." file (#+ Path)]]]
  [/
   [meta
    ["." archive (#+ Archive)
     [key (#+ Key)]
     [descriptor (#+ Descriptor Module)]
     [document (#+ Document)]]]])

(type: #export Code
  Text)

(type: #export Parameter
  Text)

(type: #export Input
  {#module Module
   #file Path
   #hash Nat
   #code Code})

(type: #export (Output o)
  (Dictionary Text o))

(type: #export (Compilation d o)
  {#dependencies (List Module)
   #process (-> Archive
                (Error (Either (Compilation d o)
                               [[Descriptor (Document d)] (Output o)])))})

(type: #export (Compiler d o)
  (-> Input (Compilation d o)))

(type: #export (Instancer d o)
  (-> (Key d) (List Parameter) (Compiler d o)))

(exception: #export (cannot-compile {module Module})
  (ex.report ["Module" module]))