From bcd3d9ee8f6797f758a2abea98d5cb6a74cc7df0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 15 Jun 2018 00:11:33 -0400 Subject: - WIP: Adjustments to new-luxc based on recent changes to stdlib. --- new-luxc/source/luxc/lang/translation/r/eval.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/r/function.jvm.lux | 8 ++++---- new-luxc/source/luxc/lang/translation/r/loop.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux | 4 ++-- new-luxc/source/luxc/lang/translation/r/reference.jvm.lux | 6 +++--- new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/r') diff --git a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux index 66e157e40..e3a255e41 100644 --- a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux @@ -65,7 +65,7 @@ (#e.Error error) (#e.Success lux-value) - (recur (n/inc idx) (array.write idx (:! Any lux-value) output)))) + (recur (inc idx) (array.write idx (:! Any lux-value) output)))) (#e.Success output))))) (def: (parse-variant lux-object host-object) diff --git a/new-luxc/source/luxc/lang/translation/r/function.jvm.lux b/new-luxc/source/luxc/lang/translation/r/function.jvm.lux index 565a44909..5ecf21c3c 100644 --- a/new-luxc/source/luxc/lang/translation/r/function.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/function.jvm.lux @@ -24,8 +24,8 @@ (def: $curried (r.var "curried")) (def: (input-declaration register) - (r.set! (referenceT.variable (n/inc register)) - (|> (@@ $curried) (r.nth (|> register n/inc nat-to-int r.int))))) + (r.set! (referenceT.variable (inc register)) + (|> (@@ $curried) (r.nth (|> register inc .int r.int))))) (def: (with-closure function-name inits function-definition) (-> Text (List Expression) Expression (Meta Expression)) @@ -57,7 +57,7 @@ (//.with-anchor [function-name +1] (translate bodyS)))) closureO+ (monad.map @ referenceT.translate-variable env) - #let [arityO (|> arity nat-to-int r.int) + #let [arityO (|> arity .int r.int) $num_args (r.var "num_args") $function (r.var function-name) var-args (r.code (format "list" (r.expression (@@ r.var-args)))) @@ -72,7 +72,7 @@ (r.cond (list [(|> (@@ $num_args) (r.= arityO)) ($_ r.then (r.set! (referenceT.variable +0) (@@ $function)) - (|> (list.n/range +0 (n/dec arity)) + (|> (list.n/range +0 (dec arity)) (list/map input-declaration) (list/fold r.then bodyO)))] [(|> (@@ $num_args) (r.> arityO)) diff --git a/new-luxc/source/luxc/lang/translation/r/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/r/loop.jvm.lux index ecaf12c7c..c64973d8f 100644 --- a/new-luxc/source/luxc/lang/translation/r/loop.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/loop.jvm.lux @@ -23,7 +23,7 @@ #let [$loop-name (r.var loop-name) @loop-name (@@ $loop-name)] _ (//.save (r.set! $loop-name - (r.function (|> (list.n/range +0 (n/dec (list.size initsS+))) + (r.function (|> (list.n/range +0 (dec (list.size initsS+))) (list/map (|>> (n/+ offset) referenceT.variable))) bodyO)))] (wrap (r.apply initsO+ @loop-name)))) 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 582cda4c6..03cc802fc 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 @@ -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/r/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux index e63066959..a7a788094 100644 --- a/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux @@ -12,7 +12,7 @@ (do-template [ ] [(def: #export ( register) (-> Register SVar) - (r.var (format (%i (nat-to-int register))))) + (r.var (format (%i (.int register))))) (def: #export ( 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/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux index 7cdc82064..7267494d5 100644 --- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux @@ -28,17 +28,17 @@ (|> input (bit.and full-32) cap-32) (n/> half-32 input) - (|> post-32 (n/- input) nat-to-int (i/* -1)) + (|> post-32 (n/- input) .int (i/* -1)) ## else - (nat-to-int input))) + (.int input))) (def: high-32 (bit.logical-right-shift +32)) (def: low-32 (|>> (bit.and (hex "+FFFFFFFF")))) (def: #export (int value) (-> Int Expression) - (let [value (int-to-nat value) + (let [value (.nat value) high (|> value ..high-32 cap-32) low (|> value ..low-32 cap-32)] (r.named-list (list [//.int-high-field (r.int high)] @@ -58,7 +58,7 @@ (def: #export (variant tag last? value) (-> Nat Bool Expression Expression) - (variant' (r.int (nat-to-int tag)) + (variant' (r.int (.int tag)) (flag last?) value)) -- cgit v1.2.3