aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler.lux
blob: 12a2f869c6256868511015a1c16f6b734c3c3a72 (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
(.module:
  [lux (#- Module Source Code)
   [control
    ["." 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 s d o)
  {#dependencies (List Module)
   #process (-> s Archive
                (Error (Either [s (Compilation s d o)]
                               [s [Descriptor (Document d)] (Output o)])))})

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

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

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