aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/compiler/default/phase/statement.lux
blob: 638f29b8031314efd097d56913f2eb9be243469a (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
(.module:
  [lux #*]
  [// (#+ Eval)
   ["." analysis
    [".A" expression]]
   ["." synthesis
    [".S" expression]]
   ["." translation (#+ Host)]
   ["." extension
    ["." bundle]
    [".E" analysis]
    [".E" synthesis]
    [".E" translation]
    ## [".E" statement]
    ]
   [//
    ["." init]]])

(type: #export (Component state phase)
  {#state state
   #phase phase})

(type: #export (State anchor expression statement)
  {#analysis (Component analysis.State+
                        analysis.Phase)
   #synthesis (Component synthesis.State+
                         synthesis.Phase)
   #translation (Component (translation.State+ anchor expression statement)
                           (translation.Phase anchor expression statement))})

(do-template [<special> <general>]
  [(type: #export (<special> anchor expression statement)
     (<general> (..State anchor expression statement) Code Any))]

  [State+    extension.State]
  [Operation extension.Operation]
  [Phase     extension.Phase]
  [Handler   extension.Handler]
  [Bundle    extension.Bundle]
  )

(def: #export (state eval translate host)
  (All [anchor expression statement]
    (-> Eval
        (translation.Phase anchor expression statement)
        (Host expression statement)
        (..State+ anchor expression statement)))
  [bundle.empty
   ## statementE.bundle
   {#analysis {#state [analysisE.bundle (init.compiler [])]
               #phase (expressionA.analyser eval)}
    #synthesis {#state [synthesisE.bundle synthesis.init]
                #phase expressionS.synthesize}
    #translation {#state [translationE.bundle (translation.state host)]
                  #phase translate}}])