aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/r
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux33
-rw-r--r--new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux67
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux56
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux58
4 files changed, 3 insertions, 211 deletions
diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
index 9554abc86..68b0bb67d 100644
--- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
@@ -231,9 +231,6 @@
[int//min runtimeT.int//min]
[int//max runtimeT.int//max]
-
- [deg//min runtimeT.int//zero]
- [deg//max runtimeT.int//-one]
)
(do-template [<name> <frac>]
@@ -256,14 +253,6 @@
[int//mul runtimeT.int//*]
[int//div runtimeT.int///]
[int//rem runtimeT.int//%]
-
- [deg//add runtimeT.int//+]
- [deg//sub runtimeT.int//-]
- [deg//rem runtimeT.int//-]
- [deg//scale runtimeT.int//*]
- [deg//mul runtimeT.deg//*]
- [deg//div runtimeT.deg///]
- [deg//reciprocal runtimeT.int///]
)
(do-template [<name> <op>]
@@ -290,9 +279,6 @@
[int//= runtimeT.int//=]
[int//< runtimeT.int//<]
-
- [deg//= runtimeT.int//=]
- [deg//< runtimeT.int//<]
)
(def: (apply1 func)
@@ -318,23 +304,6 @@
(install "to-frac" (unary runtimeT.int//to-float))
(install "char" (unary int//char)))))
-(def: deg-procs
- Bundle
- (<| (prefix "deg")
- (|> (dict.new text.Hash<Text>)
- (install "+" (binary deg//add))
- (install "-" (binary deg//sub))
- (install "*" (binary deg//mul))
- (install "/" (binary deg//div))
- (install "%" (binary deg//rem))
- (install "=" (binary deg//=))
- (install "<" (binary deg//<))
- (install "scale" (binary deg//scale))
- (install "reciprocal" (binary deg//reciprocal))
- (install "min" (nullary deg//min))
- (install "max" (nullary deg//max))
- (install "to-frac" (unary runtimeT.deg//to-frac)))))
-
(def: (frac//encode value)
(-> Expression Expression)
(r.apply (list (r.string "%f") value) (r.global "sprintf")))
@@ -356,7 +325,6 @@
(install "not-a-number" (nullary frac//not-a-number))
(install "positive-infinity" (nullary frac//positive-infinity))
(install "negative-infinity" (nullary frac//negative-infinity))
- (install "to-deg" (unary runtimeT.deg//from-frac))
(install "to-int" (unary (apply1 (r.global "as.integer"))))
(install "encode" (unary frac//encode))
(install "decode" (unary runtimeT.frac//decode)))))
@@ -517,7 +485,6 @@
(|> lux-procs
(dict.merge bit-procs)
(dict.merge int-procs)
- (dict.merge deg-procs)
(dict.merge frac-procs)
(dict.merge text-procs)
(dict.merge array-procs)
diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
index 70a9f62df..ced898662 100644
--- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
@@ -664,72 +664,6 @@
@@bit//logical-right-shift
))
-(runtime: (deg//* param subject)
- (with-vars [sL sH pL pH bottom middle top]
- ($_ r.then
- (r.set! sL (int//from-float (int64-low (@@ subject))))
- (r.set! sH (int//from-float (int64-high (@@ subject))))
- (r.set! pL (int//from-float (int64-low (@@ param))))
- (r.set! pH (int//from-float (int64-high (@@ param))))
- (let [bottom (bit//logical-right-shift (r.int 32)
- (int//* (@@ pL) (@@ sL)))
- middle (int//+ (int//* (@@ pL) (@@ sH))
- (int//* (@@ pH) (@@ sL)))
- top (int//* (@@ pH) (@@ sH))]
- (|> bottom
- (int//+ middle)
- (bit//logical-right-shift (r.int 32))
- (int//+ top))))))
-
-(runtime: (deg//leading-zeroes input)
- (with-vars [zeroes remaining]
- ($_ r.then
- (r.set! zeroes (r.int 64))
- (r.set! remaining (@@ input))
- (r.while (|> (@@ remaining) (int//= int//zero) r.not)
- ($_ r.then
- (r.set! zeroes (|> (@@ zeroes) (r.- (r.int 1))))
- (r.set! remaining (|> (@@ remaining) (bit//logical-right-shift (r.int 1))))))
- (@@ zeroes))))
-
-(runtime: (deg/// param subject)
- (with-vars [min-shift]
- (r.if (|> (@@ subject) (int//= (@@ param)))
- int//-one
- ($_ r.then
- (r.set! min-shift
- (r.apply (list (deg//leading-zeroes (@@ param))
- (deg//leading-zeroes (@@ subject)))
- (r.global "min")))
- (let [subject' (|> (@@ subject) (bit//left-shift (@@ min-shift)))
- param' (|> (@@ param) (bit//left-shift (@@ min-shift)) int64-high int//from-float)]
- (|> subject'
- (int/// param')
- (bit//left-shift (r.int 32))))))))
-
-(runtime: (deg//from-frac input)
- (with-vars [two32 shifted]
- ($_ r.then
- (r.set! two32 (|> (r.float 2.0) (r.** (r.float 32.0))))
- (r.set! shifted (|> (@@ input) (r.%% (r.float 1.0)) (r.* (@@ two32))))
- (let [low (|> (@@ shifted) (r.%% (r.float 1.0)) (r.* (@@ two32)) as-integer)
- high (|> (@@ shifted) as-integer)]
- (int//new high low)))))
-
-(runtime: (deg//to-frac input)
- (let [high (|> (int64-high (@@ input)) (r./ f2^32))
- low (|> (int64-low (@@ input)) (r./ f2^32) (r./ f2^32))]
- (|> low (r.+ high))))
-
-(def: runtime//deg
- Runtime
- ($_ r.then
- @@deg//*
- @@deg//leading-zeroes
- @@deg///
- @@deg//from-frac
- @@deg//to-frac))
-
(runtime: (frac//decode input)
(with-vars [output]
($_ r.then
@@ -958,7 +892,6 @@
runtime//bit
runtime//int
runtime//adt
- runtime//deg
runtime//frac
runtime//text
runtime//array
diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
index e38dfff28..729acd978 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
@@ -236,9 +236,6 @@
[frac//smallest Double::MIN_VALUE ruby.float]
[frac//min (f/* -1.0 Double::MAX_VALUE) ruby.float]
[frac//max Double::MAX_VALUE ruby.float]
-
- [deg//min 0 ruby.int]
- [deg//max -1 ruby.int]
)
(do-template [<name> <expression>]
@@ -278,14 +275,6 @@
[int//div ruby./]
[int//rem ruby.%]
-
- [deg//add ruby.+]
- [deg//sub ruby.-]
- [deg//mul runtimeT.deg//*]
- [deg//div runtimeT.deg///]
- [deg//rem ruby.-]
- [deg//scale ruby.*]
- [deg//reciprocal ruby./]
)
(do-template [<name> <op>]
@@ -312,8 +301,7 @@
[int//= ruby.=]
[int//< ruby.<]
- [deg//= ruby.=]
- [deg//< ruby.<])
+ )
(def: frac//encode
Unary
@@ -331,25 +319,6 @@
(ruby.return! (runtimeT.some "temp"))
(ruby.return! runtimeT.none)))))))
-(do-template [<name> <divisor>]
- [(def: (<name> inputO)
- Unary
- (ruby./ <divisor> inputO))]
-
- [int//to-frac (ruby.float 1.0)]
- [deg//to-frac (ruby.send "to_f" (list)
- (ruby.bit-shl (ruby.int 32) (ruby.int 1)))]
- )
-
-(do-template [<name> <transform>]
- [(def: <name>
- Unary
- <transform>)]
-
- [frac//to-int (ruby.send "floor" (list))]
- [frac//to-deg runtimeT.deg//from-frac]
- )
-
(def: int-procs
Bundle
(<| (prefix "int")
@@ -363,26 +332,9 @@
(install "<" (binary int//<))
(install "min" (nullary int//min))
(install "max" (nullary int//max))
- (install "to-frac" (unary int//to-frac))
+ (install "to-frac" (unary (ruby./ (ruby.float 1.0))))
(install "char" (unary (ruby.send "chr" (list)))))))
-(def: deg-procs
- Bundle
- (<| (prefix "deg")
- (|> (dict.new text.Hash<Text>)
- (install "+" (binary deg//add))
- (install "-" (binary deg//sub))
- (install "*" (binary deg//mul))
- (install "/" (binary deg//div))
- (install "%" (binary deg//rem))
- (install "=" (binary deg//=))
- (install "<" (binary deg//<))
- (install "scale" (binary deg//scale))
- (install "reciprocal" (binary deg//reciprocal))
- (install "min" (nullary deg//min))
- (install "max" (nullary deg//max))
- (install "to-frac" (unary deg//to-frac)))))
-
(def: frac-procs
Bundle
(<| (prefix "frac")
@@ -400,8 +352,7 @@
(install "not-a-number" (nullary frac//not-a-number))
(install "positive-infinity" (nullary frac//positive-infinity))
(install "negative-infinity" (nullary frac//negative-infinity))
- (install "to-deg" (unary frac//to-deg))
- (install "to-int" (unary frac//to-int))
+ (install "to-int" (unary (ruby.send "floor" (list))))
(install "encode" (unary frac//encode))
(install "decode" (unary frac//decode)))))
@@ -608,7 +559,6 @@
(|> lux-procs
(dict.merge bit-procs)
(dict.merge int-procs)
- (dict.merge deg-procs)
(dict.merge frac-procs)
(dict.merge text-procs)
(dict.merge array-procs)
diff --git a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
index 7f66b0cd5..ac8f7b11a 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
@@ -178,63 +178,6 @@
(format @@bit//count
@@bit//logical-right-shift))
-(def: high (-> Expression Expression) (bit//logical-right-shift (ruby.int 32)))
-(def: low (-> Expression Expression) (ruby.bit-and "0xFFFFFFFF"))
-
-(runtime: (deg//* param subject)
- (ruby.block! (list (ruby.set! (list "sL") (low subject))
- (ruby.set! (list "sH") (high subject))
- (ruby.set! (list "pL") (low param))
- (ruby.set! (list "pH") (high param))
- (ruby.set! (list "bottom") (bit//logical-right-shift (ruby.int 32)
- (ruby.* "pL" "sL")))
- (ruby.set! (list "middle") (ruby.+ (ruby.* "pL" "sH")
- (ruby.* "pH" "sL")))
- (ruby.set! (list "top") (ruby.* "pH" "sH"))
- (ruby.return! (|> "bottom"
- (ruby.+ "middle")
- high
- (ruby.+ "top"))))))
-
-(runtime: (deg//leading-zeroes input)
- (ruby.block! (list (ruby.set! (list "zeroes") (ruby.int 64))
- (ruby.while! (ruby.not (ruby.= (ruby.int 0) input))
- (ruby.block! (list (ruby.set! (list "zeroes") (ruby.- (ruby.int 1) "zeroes"))
- (ruby.set! (list input) (bit//logical-right-shift (ruby.int 1) input)))))
- (ruby.return! "zeroes"))))
-
-(runtime: (deg/// param subject)
- (ruby.if! (ruby.= param subject)
- (ruby.return! (ruby.int -1))
- (ruby.block! (list (ruby.set! (list "min_shift")
- (ruby.send "min" (list)
- (ruby.array (list (deg//leading-zeroes param)
- (deg//leading-zeroes subject)))))
- (ruby.return! (|> (ruby.bit-shl "min_shift" subject)
- (ruby./ (|> param (ruby.bit-shl "min_shift") low))
- (ruby.bit-shl (ruby.int 32))))))))
-
-(runtime: (deg//from-frac input)
- (let [->int (ruby.send "floor" (list))]
- (ruby.block! (list (ruby.set! (list "two32") (ruby.pow (ruby.float 32.0) (ruby.float 2.0)))
- (ruby.set! (list "shifted") (|> input
- (ruby.% (ruby.float 1.0))
- (ruby.* "two32")))
- (ruby.set! (list "low") (|> "shifted"
- (ruby.% (ruby.float 1.0))
- (ruby.* "two32")
- ->int))
- (ruby.set! (list "high") (|> "shifted" ->int))
- (ruby.return! (ruby.+ (ruby.bit-shl (ruby.int 32) "high")
- "low"))))))
-
-(def: runtime//deg
- Runtime
- (format @@deg//*
- @@deg//leading-zeroes
- @@deg///
- @@deg//from-frac))
-
(runtime: (text//index subject param start)
(ruby.block! (list (ruby.set! (list "idx") (ruby.send "index" (list param start) subject))
(ruby.if! (ruby.= ruby.nil "idx")
@@ -332,7 +275,6 @@
(format runtime//lux "\n"
runtime//adt "\n"
runtime//bit "\n"
- runtime//deg "\n"
runtime//text "\n"
runtime//array "\n"
runtime//atom "\n"