aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/ruby
diff options
context:
space:
mode:
authorEduardo Julian2018-06-15 00:11:33 -0400
committerEduardo Julian2018-06-15 00:11:33 -0400
commitbcd3d9ee8f6797f758a2abea98d5cb6a74cc7df0 (patch)
treeb122b9ecf2d5333ba97cffbadfeee00eba2e1cf8 /new-luxc/source/luxc/lang/translation/ruby
parent0190e084c6f44be32ea2bc5a89ef55b52bdc789b (diff)
- WIP: Adjustments to new-luxc based on recent changes to stdlib.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/ruby')
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/function.jvm.lux8
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/loop.jvm.lux2
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux2
6 files changed, 12 insertions, 12 deletions
diff --git a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux
index 49bf7f1da..7d43e5460 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux
@@ -43,7 +43,7 @@
(if (n/< size idx)
(case (RubyArray::get [(:! Int idx)] host-object)
#.None
- (recur (n/inc idx) output)
+ (recur (inc idx) output)
(#.Some value)
(case (lux-object value)
@@ -51,7 +51,7 @@
(#e.Error error)
(#e.Success lux-value)
- (recur (n/inc idx) (array.write idx lux-value output))))
+ (recur (inc idx) (array.write idx lux-value output))))
(#e.Success output)))))
(def: (variant lux-object host-object)
diff --git a/new-luxc/source/luxc/lang/translation/ruby/function.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/function.jvm.lux
index f5d64459d..aecabc914 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/function.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/function.jvm.lux
@@ -23,7 +23,7 @@
(def: (input-declaration registers)
(-> (List Register) Statement)
- (ruby.set! (list.concat (list (list/map (|>> n/inc referenceT.variable) registers)
+ (ruby.set! (list.concat (list (list/map (|>> inc referenceT.variable) registers)
(list "_")))
"curried"))
@@ -51,10 +51,10 @@
(//.with-anchor [function-name +1]
(translate bodyS))))
closureO+ (monad.map @ referenceT.translate-variable env)
- #let [args-initsO+ (input-declaration (list.n/range +0 (n/dec arity)))
+ #let [args-initsO+ (input-declaration (list.n/range +0 (dec arity)))
selfO (ruby.set! (list (referenceT.variable +0)) function-name)
- arityO (|> arity nat-to-int %i)
- limitO (|> arity n/dec nat-to-int %i)]]
+ arityO (|> arity .int %i)
+ limitO (|> arity dec .int %i)]]
(wrap (with-closure closureO+
(ruby.lambda (#.Some function-name)
(list (ruby.splat "curried"))
diff --git a/new-luxc/source/luxc/lang/translation/ruby/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/loop.jvm.lux
index e4da02c2a..3c2124565 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/loop.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/loop.jvm.lux
@@ -20,7 +20,7 @@
initsO+ (monad.map @ translate initsS+)
bodyO (//.with-anchor [loop-name offset]
(translate bodyS))
- #let [registersO+ (|> (list.n/range +0 (n/dec (list.size initsS+)))
+ #let [registersO+ (|> (list.n/range +0 (dec (list.size initsS+)))
(list/map (|>> (n/+ offset) referenceT.variable)))]
_ (//.save (ruby.function! loop-name registersO+
(ruby.return! bodyO)))]
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 a8d4efc4a..7fb521751 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
@@ -57,8 +57,8 @@
(def: (wrong-arity proc expected actual)
(-> Text Nat Nat Text)
(format "Wrong number of arguments for " (%t proc) "\n"
- "Expected: " (|> expected nat-to-int %i) "\n"
- " Actual: " (|> actual nat-to-int %i)))
+ "Expected: " (|> expected .int %i) "\n"
+ " Actual: " (|> actual .int %i)))
(syntax: (arity: {name s.local-symbol} {arity s.nat})
(with-gensyms [g!_ g!proc g!name g!translate g!inputs]
diff --git a/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux
index 9612cdb7a..b778d090a 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux
@@ -12,7 +12,7 @@
(do-template [<register> <translation> <prefix>]
[(def: #export (<register> register)
(-> Register Expression)
- (format <prefix> (%i (nat-to-int register))))
+ (format <prefix> (%i (.int register))))
(def: #export (<translation> register)
(-> Register (Meta Expression))
@@ -25,7 +25,7 @@
(-> Variable (Meta Expression))
(if (variableL.captured? var)
(translate-captured (variableL.captured-register var))
- (translate-local (int-to-nat var))))
+ (translate-local (.nat var))))
(def: #export global
(-> Ident Expression)
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 bb0549259..7e94101ff 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
@@ -30,7 +30,7 @@
(def: #export (variant tag last? value)
(-> Nat Bool Expression Expression)
- (variant' (%i (nat-to-int tag)) (flag last?) value))
+ (variant' (%i (.int tag)) (flag last?) value))
(def: #export none
Expression