aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler/phase/statement.lux
blob: ba84d146f20071365997ddb67ed70c69b68e0cc1 (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 #*]
  ["." //
   ["." translation]
   ["." extension]
   [//
    ["." analysis]
    ["." synthesis]]])

(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]
  )

(do-template [<name> <component> <operation>]
  [(def: #export (<name> operation)
     (All [anchor expression statement output]
       (-> (<operation> output)
           (Operation anchor expression statement output)))
     (extension.lift
      (//.sub [(get@ [<component> #..state])
               (set@ [<component> #..state])]
              operation)))]

  [lift-analysis    #..analysis    analysis.Operation]
  [lift-synthesis   #..synthesis   synthesis.Operation]
  [lift-translation #..translation (translation.Operation anchor expression statement)]
  )