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

(type: #export Code Text)

(type: #export Parameter Text)

(type: #export Input
  {#module Module
   #file File
   #code Code})

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

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

(type: #export (Compiler d)
  (-> (Key d) (List Parameter) Input (Compilation d)))

(type: #export (Importer !)
  (-> (file.System !) Module Archive (! (Error Archive))))

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