aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/lua
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/lua
parent0190e084c6f44be32ea2bc5a89ef55b52bdc789b (diff)
- WIP: Adjustments to new-luxc based on recent changes to stdlib.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/lua.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux6
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/function.jvm.lux8
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux2
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux2
7 files changed, 15 insertions, 15 deletions
diff --git a/new-luxc/source/luxc/lang/translation/lua.lux b/new-luxc/source/luxc/lang/translation/lua.lux
index 94a703300..d09746351 100644
--- a/new-luxc/source/luxc/lang/translation/lua.lux
+++ b/new-luxc/source/luxc/lang/translation/lua.lux
@@ -118,14 +118,14 @@
(function (_ compiler)
(let [old (:! Host (get@ #.host compiler))
[old-name old-sub] (get@ #context old)
- new-name (format old-name "___" (%i (nat-to-int old-sub)))]
+ new-name (format old-name "___" (%i (.int old-sub)))]
(case (expr (set@ #.host
(:! Nothing (set@ #context [new-name +0] old))
compiler))
(#e.Success [compiler' output])
(#e.Success [(update@ #.host
(|>> (:! Host)
- (set@ #context [old-name (n/inc old-sub)])
+ (set@ #context [old-name (inc old-sub)])
(:! Nothing))
compiler')
[new-name output]])
diff --git a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
index 68b41e6d7..0e413e7ad 100644
--- a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
@@ -60,17 +60,17 @@
output (: (Array Object)
(array.new init-num-keys))]
(if (n/< num-keys idx)
- (case (Table::get-idx (:! Long (n/inc idx)) host-object)
+ (case (Table::get-idx (:! Long (inc idx)) host-object)
(#.Some member)
(case (lux-object member)
(#e.Success parsed-member)
- (recur num-keys (n/inc idx) (array.write idx (:! Object parsed-member) output))
+ (recur num-keys (inc idx) (array.write idx (:! Object parsed-member) output))
(#e.Error error)
#.None)
#.None
- (recur num-keys (n/inc idx) output))
+ (recur num-keys (inc idx) output))
(#.Some output)))))
(def: (lux-object host-object)
diff --git a/new-luxc/source/luxc/lang/translation/lua/function.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/function.jvm.lux
index 042ddd824..02b322de6 100644
--- a/new-luxc/source/luxc/lang/translation/lua/function.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/function.jvm.lux
@@ -23,8 +23,8 @@
(wrap (lua.apply functionO argsO+))))
(def: (input-declaration register)
- (lua.local! (referenceT.variable (n/inc register))
- (#.Some (lua.nth (|> register n/inc nat-to-int %i) "curried"))))
+ (lua.local! (referenceT.variable (inc register))
+ (#.Some (lua.nth (|> register inc .int %i) "curried"))))
(def: (with-closure function-name inits function-definition)
(-> Text (List Expression) Statement (Meta Expression))
@@ -55,10 +55,10 @@
(//.with-anchor [function-name +1]
(translate bodyS))))
closureO+ (monad.map @ referenceT.translate-variable env)
- #let [args-initsO+ (|> (list.n/range +0 (n/dec arity))
+ #let [args-initsO+ (|> (list.n/range +0 (dec arity))
(list/map input-declaration))
selfO (lua.local! (referenceT.variable +0) (#.Some function-name))
- arityO (|> arity nat-to-int %i)
+ arityO (|> arity .int %i)
pack (|>> (list) (lua.apply "table.pack"))]]
(with-closure function-name closureO+
(lua.function! function-name (list "...")
diff --git a/new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux
index d00f6910d..4bad74069 100644
--- a/new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/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 (lua.function! loop-name registersO+
(lua.return! bodyO)))]
diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
index f3b437444..50fe74f58 100644
--- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/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/lua/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux
index 0760e700a..b491c9dd4 100644
--- a/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/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/lua/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
index ace528429..5a0d62225 100644
--- a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/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: none
Expression