aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/python
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/python
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/python.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/python/case.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/python/eval.jvm.lux2
-rw-r--r--new-luxc/source/luxc/lang/translation/python/function.jvm.lux8
-rw-r--r--new-luxc/source/luxc/lang/translation/python/loop.jvm.lux2
-rw-r--r--new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/python/reference.jvm.lux6
-rw-r--r--new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux2
8 files changed, 16 insertions, 16 deletions
diff --git a/new-luxc/source/luxc/lang/translation/python.lux b/new-luxc/source/luxc/lang/translation/python.lux
index 604f06019..3dde69d2a 100644
--- a/new-luxc/source/luxc/lang/translation/python.lux
+++ b/new-luxc/source/luxc/lang/translation/python.lux
@@ -88,14 +88,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/python/case.jvm.lux b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
index 2c32b26a6..f51acc402 100644
--- a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
@@ -191,7 +191,7 @@
(let [outer recur]
(case pathP
(^code ("lux case bind" (~ [_ (#.Nat register)])))
- (update@ #bindings (set.add (nat-to-int register))
+ (update@ #bindings (set.add (.int register))
outer-variables)
(^or (^code ("lux case seq" (~ leftP) (~ rightP)))
@@ -224,7 +224,7 @@
(list/fold inner inner-variables))
(^code ("lux let" (~ [_ (#.Nat register)]) (~ inputS) (~ exprS)))
- (list/fold inner (update@ #bindings (set.add (nat-to-int register))
+ (list/fold inner (update@ #bindings (set.add (.int register))
inner-variables)
(list inputS exprS))
diff --git a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
index 6f4e43f9d..df1e7004c 100644
--- a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
@@ -60,7 +60,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: python-type
diff --git a/new-luxc/source/luxc/lang/translation/python/function.jvm.lux b/new-luxc/source/luxc/lang/translation/python/function.jvm.lux
index 97b936fc4..32522d1c0 100644
--- a/new-luxc/source/luxc/lang/translation/python/function.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/function.jvm.lux
@@ -24,8 +24,8 @@
(def: $curried (python.var "curried"))
(def: (input-declaration register)
- (python.set! (list (referenceT.variable (n/inc register)))
- (python.nth (|> register nat-to-int python.int)
+ (python.set! (list (referenceT.variable (inc register)))
+ (python.nth (|> register .int python.int)
(@@ $curried))))
(def: (with-closure function-name inits function-definition)
@@ -58,14 +58,14 @@
(//.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)
(case> #.Nil
python.no-op!
(#.Cons head tail)
(list/fold python.then! head tail)))
- arityO (|> arity nat-to-int python.int)
+ arityO (|> arity .int python.int)
@curried (@@ $curried)
$num_args (python.var "num_args")
@num_args (@@ $num_args)
diff --git a/new-luxc/source/luxc/lang/translation/python/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/python/loop.jvm.lux
index e490033bf..f6e3ca4c3 100644
--- a/new-luxc/source/luxc/lang/translation/python/loop.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/loop.jvm.lux
@@ -22,7 +22,7 @@
(translate bodyS))
#let [$loop-name (python.var loop-name)
@loop-name (@@ $loop-name)]
- _ (//.save (python.def! $loop-name (|> (list.n/range +0 (n/dec (list.size initsS+)))
+ _ (//.save (python.def! $loop-name (|> (list.n/range +0 (dec (list.size initsS+)))
(list/map (|>> (n/+ offset) referenceT.variable)))
(python.return! bodyO)))]
(wrap (python.apply initsO+ @loop-name))))
diff --git a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
index e76b369fc..6cd163210 100644
--- a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
@@ -58,8 +58,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/python/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/python/reference.jvm.lux
index 1f29da34a..7cb3390f5 100644
--- a/new-luxc/source/luxc/lang/translation/python/reference.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/reference.jvm.lux
@@ -12,7 +12,7 @@
(do-template [<register> <translation> <prefix>]
[(def: #export (<register> register)
(-> Register SVar)
- (python.var (format <prefix> (%i (nat-to-int register)))))
+ (python.var (format <prefix> (%i (.int register)))))
(def: #export (<translation> register)
(-> Register (Meta Expression))
@@ -25,13 +25,13 @@
(-> Variable SVar)
(if (variableL.captured? var)
(closure (variableL.captured-register var))
- (variable (int-to-nat var))))
+ (variable (.nat var))))
(def: #export (translate-variable var)
(-> 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 SVar)
diff --git a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
index 282d7536e..fbd599c77 100644
--- a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
@@ -30,7 +30,7 @@
(def: #export (variant tag last? value)
(-> Nat Bool Expression Expression)
- (variant' (python.int (nat-to-int tag))
+ (variant' (python.int (.int tag))
(flag last?)
value))