aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/source/luxc/lang/translation/jvm/expression.lux
blob: 692835dc4c2aa6f2c2e2725fda22d9983dc5603d (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
(.using
 [library
  [lux "*"
   [tool
    [compiler
     [language
      [lux
       ["[0]" synthesis]
       [phase
        ["[0]" extension]]]]]]]]
 [luxc
  [lang
   [host
    [jvm {"+" Phase}]]]]
 [//
  ["[0]" primitive]
  ["[0]" structure]
  ["[0]" reference]
  ["[0]" case]
  ["[0]" loop]
  ["[0]" function]])

(def: .public (translate archive synthesis)
  Phase
  (case synthesis
    (pattern (synthesis.bit value))
    (primitive.bit value)
    
    (pattern (synthesis.i64 value))
    (primitive.i64 value)
    
    (pattern (synthesis.f64 value))
    (primitive.f64 value)
    
    (pattern (synthesis.text value))
    (primitive.text value)

    (pattern (synthesis.variant data))
    (structure.variant translate archive data)

    (pattern (synthesis.tuple members))
    (structure.tuple translate archive members)

    (pattern (synthesis.variable variable))
    (reference.variable archive variable)

    (pattern (synthesis.constant constant))
    (reference.constant archive constant)

    (pattern (synthesis.branch/exec it))
    (case.exec translate archive it)

    (pattern (synthesis.branch/let data))
    (case.let translate archive data)

    (pattern (synthesis.branch/if data))
    (case.if translate archive data)

    (pattern (synthesis.branch/get data))
    (case.get translate archive data)

    (pattern (synthesis.branch/case data))
    (case.case translate archive data)

    (pattern (synthesis.loop/again data))
    (loop.again translate archive data)

    (pattern (synthesis.loop/scope data))
    (loop.scope translate archive data)

    (pattern (synthesis.function/apply data))
    (function.call translate archive data)

    (pattern (synthesis.function/abstraction data))
    (function.function translate archive data)

    {synthesis.#Extension extension}
    (extension.apply archive translate extension)))