diff options
Diffstat (limited to 'new-luxc/source/luxc')
22 files changed, 23 insertions, 91 deletions
diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux index 41e93c13b..9d781429e 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux @@ -118,7 +118,7 @@ ([#.Bool _.bool _.equal] [#.Nat (<| _.int (:coerce Int)) _.=] [#.Int _.int _.=] - [#.Deg (<| _.int (:coerce Int)) _.=] + [#.Rev (<| _.int (:coerce Int)) _.=] [#.Frac _.float _.=] [#.Text _.string _.equal]) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux index b002341cc..4e0c617b4 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux @@ -41,7 +41,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux index 4e26c4218..1c8c17bed 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux @@ -13,14 +13,6 @@ (-> Int (Meta Expression)) (|>> _.int meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) _.int meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) _.int meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> _.double meta/wrap)) diff --git a/new-luxc/source/luxc/lang/translation/js/case.jvm.lux b/new-luxc/source/luxc/lang/translation/js/case.jvm.lux index 3abd8c55c..fc01a9d7c 100644 --- a/new-luxc/source/luxc/lang/translation/js/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/case.jvm.lux @@ -100,7 +100,7 @@ (wrap (format "if(!" (format runtimeT.int//= "(" peek-cursor "," valueJS ")") ") { " fail-pattern-matching " }")))) ([#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg]) + [#.Rev primitiveT.translate-rev]) (^template [<tag> <format>] [_ (<tag> value)] diff --git a/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux index ba6c63e8f..8a5e73c75 100644 --- a/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux @@ -45,7 +45,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux index 5fedc9a9e..753f1ce45 100644 --- a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux @@ -15,27 +15,11 @@ (def: low-mask Nat (dec (bit.left-shift +32 +1))) -(def: #export (translate-nat value) - (-> Nat (Meta Expression)) - (let [high (|> value - (bit.logical-right-shift +32) - .int %i) - low (|> value - (bit.and low-mask) - .int %i)] - (meta/wrap (format runtimeT.int//new "(" high "," low ")")))) - -(def: #export translate-int +(def: #export (translate-int value) (-> Int (Meta Expression)) - (|>> .nat translate-nat)) - -(def: deg-to-nat - (-> Deg Nat) - (|>> (:coerce Nat))) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> deg-to-nat translate-nat)) + (let [high (|> value (bit.logical-right-shift +32) %i) + low (|> value (bit.and low-mask) %i)] + (meta/wrap (format runtimeT.int//new "(" high "," low ")")))) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux index f5d288827..18309b0e5 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux @@ -79,16 +79,12 @@ ($i.unwrap #$.Boolean) (jumpI @else)))) - (^template [<tag> <prep>] - [_ (<tag> value)] - (macro/wrap (|>> peekI - ($i.unwrap #$.Long) - ($i.long (|> value <prep>)) - $i.LCMP - ($i.IFNE @else)))) - ([#.Nat (:coerce Int)] - [#.Int (: Int)] - [#.Deg (:coerce Int)]) + [_ (#.Int value)] + (macro/wrap (|>> peekI + ($i.unwrap #$.Long) + ($i.long value) + $i.LCMP + ($i.IFNE @else))) [_ (#.Frac value)] (macro/wrap (|>> peekI diff --git a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux index a72bf0011..70d2330f4 100644 --- a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux @@ -104,7 +104,7 @@ (lua.return! pm-error)))) ([#.Nat (<| lua.int (:coerce Int))] [#.Int lua.int] - [#.Deg (<| lua.int (:coerce Int))] + [#.Rev (<| lua.int (:coerce Int))] [#.Bool lua.bool] [#.Frac lua.float] [#.Text lua.string]) diff --git a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux index e2c626e83..9632d5708 100644 --- a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux @@ -45,7 +45,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux index 5769f6890..4a6c78b04 100644 --- a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux @@ -14,14 +14,6 @@ (-> Int (Meta Expression)) (|>> %i meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) %i meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) %i meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> (cond> [(f/= number.positive-infinity)] diff --git a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux index 6f78637cf..0e0aecb7d 100644 --- a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux @@ -114,9 +114,7 @@ [_ (<tag> value)] (meta/wrap (_.when! (_.not (_.= (|> value <format>) cursor-top)) fail-pm!))) - ([#.Nat (<| _.int (:coerce Int))] - [#.Int _.int] - [#.Deg (<| _.int (:coerce Int))] + ([#.Int _.int] [#.Bool _.bool] [#.Frac _.float] [#.Text _.string]) diff --git a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux index cd67be0f0..420775734 100644 --- a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux @@ -37,9 +37,7 @@ [_ (<tag> value)] (|> value <generator>)) ([#.Bool primitiveT.translate-bool] - [#.Nat (<| primitiveT.translate-int (:coerce Int))] [#.Int primitiveT.translate-int] - [#.Deg (<| primitiveT.translate-int (:coerce Int))] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux index aedf2a6e1..8e5b16a88 100644 --- a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux @@ -117,7 +117,7 @@ fail-pm!))) ([#.Nat (<| python.int (:coerce Int))] [#.Int python.int] - [#.Deg (<| python.int (:coerce Int))] + [#.Rev (<| python.int (:coerce Int))] [#.Bool python.bool] [#.Frac python.float] [#.Text python.string]) diff --git a/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux index d153d8953..a1abe59a6 100644 --- a/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux @@ -44,7 +44,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux index f1cf731a2..439404893 100644 --- a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux @@ -11,14 +11,6 @@ (-> Int (Meta Expression)) (|>> python.int meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) python.int meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) python.int meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> python.float meta/wrap)) diff --git a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux index 3aa3d4a8a..fb16b8791 100644 --- a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux @@ -126,7 +126,7 @@ fail-pm!))) ([#.Nat (<| runtimeT.int (:coerce Int))] [#.Int runtimeT.int] - [#.Deg (<| runtimeT.int (:coerce Int))]) + [#.Rev (<| runtimeT.int (:coerce Int))]) (^template [<pm> <getter>] (^code (<pm> (~ [_ (#.Nat idx)]))) diff --git a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux index d68f6055e..cd2227df3 100644 --- a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux @@ -42,7 +42,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux index ad89f2e31..3652dfcfd 100644 --- a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux @@ -13,14 +13,6 @@ (-> Int (Meta Expression)) (|>> runtimeT.int meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) runtimeT.int meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) runtimeT.int meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> r.float meta/wrap)) diff --git a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux index b7b1f131d..2cce1abf5 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux @@ -107,9 +107,7 @@ [_ (<tag> value)] (meta/wrap (ruby.when! (ruby.not (ruby.= (|> value <format>) cursor-top)) (ruby.raise pm-error)))) - ([#.Nat (<| ruby.int (:coerce Int))] - [#.Int ruby.int] - [#.Deg (<| ruby.int (:coerce Int))] + ([#.Int ruby.int] [#.Bool ruby.bool] [#.Frac ruby.float] [#.Text ruby.string]) diff --git a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux index 96728731d..6d829f81c 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux @@ -42,9 +42,7 @@ [_ (<tag> value)] (<generator> value)) ([#.Bool primitiveT.translate-bool] - [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux index 1f05cf2fd..f84c700d4 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux @@ -14,14 +14,6 @@ (-> Int (Meta Expression)) (|>> %i meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) %i meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) %i meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> (cond> [(f/= number.positive-infinity)] diff --git a/new-luxc/source/luxc/repl.lux b/new-luxc/source/luxc/repl.lux index a6579e939..2fb62a3b4 100644 --- a/new-luxc/source/luxc/repl.lux +++ b/new-luxc/source/luxc/repl.lux @@ -113,7 +113,7 @@ [Bool %b] [Nat %n] [Int %i] - [Deg %d] + [Rev %r] [Frac %f] [Text %t]))))) |