From 0c20f4a8362d42572edecb6ef9844b75c4c859f8 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 28 Apr 2019 02:09:34 -0400 Subject: Turned all "lux int ???" extensions to "lux i64 ???". --- luxc/src/lux/analyser/proc/common.clj | 24 +++++----- luxc/src/lux/compiler/jvm/proc/common.clj | 19 ++++---- .../luxc/lang/translation/jvm/procedure/common.lux | 56 ++++++++++------------ stdlib/source/lux.lux | 44 ++++++++--------- stdlib/source/lux/data/text.lux | 2 +- stdlib/source/lux/tool/compiler/default/syntax.lux | 2 +- .../compiler/phase/extension/analysis/common.lux | 10 +--- .../source/spec/compositor/generation/common.lux | 12 ++--- .../compiler/phase/extension/analysis/common.lux | 12 ++--- 9 files changed, 83 insertions(+), 98 deletions(-) diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj index d08b6f402..75c2cd3c9 100644 --- a/luxc/src/lux/analyser/proc/common.clj +++ b/luxc/src/lux/analyser/proc/common.clj @@ -151,10 +151,10 @@ analyse-i64-add ["i64" "+"] (&/$Apply &type/Any &type/I64) &type/I64 analyse-i64-sub ["i64" "-"] (&/$Apply &type/Any &type/I64) &type/I64 - analyse-int-mul ["int" "*"] &type/Int &type/Int - analyse-int-div ["int" "/"] &type/Int &type/Int - analyse-int-rem ["int" "%"] &type/Int &type/Int - analyse-int-lt ["int" "<"] &type/Int &type/Bit + analyse-int-mul ["i64" "*"] &type/Int &type/Int + analyse-int-div ["i64" "/"] &type/Int &type/Int + analyse-int-rem ["i64" "%"] &type/Int &type/Int + analyse-int-lt ["i64" "<"] &type/Int &type/Bit analyse-frac-add ["f64" "+"] &type/Frac &type/Frac analyse-frac-sub ["f64" "-"] &type/Frac &type/Frac @@ -208,8 +208,8 @@ (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ) (&/|list =x) (&/|list))))))) - analyse-int-char &type/Int &type/Text ["int" "char"] - analyse-int-frac &type/Int &type/Frac ["int" "f64"] + analyse-int-char &type/Int &type/Text ["i64" "char"] + analyse-int-frac &type/Int &type/Frac ["i64" "f64"] analyse-frac-int &type/Frac &type/Int ["f64" "i64"] analyse-io-log &type/Text &type/Any ["io" "log"] @@ -274,12 +274,12 @@ "lux i64 -" (analyse-i64-sub analyse exo-type ?values) "lux i64 =" (analyse-i64-eq analyse exo-type ?values) - "lux int *" (analyse-int-mul analyse exo-type ?values) - "lux int /" (analyse-int-div analyse exo-type ?values) - "lux int %" (analyse-int-rem analyse exo-type ?values) - "lux int <" (analyse-int-lt analyse exo-type ?values) - "lux int f64" (analyse-int-frac analyse exo-type ?values) - "lux int char" (analyse-int-char analyse exo-type ?values) + "lux i64 *" (analyse-int-mul analyse exo-type ?values) + "lux i64 /" (analyse-int-div analyse exo-type ?values) + "lux i64 %" (analyse-int-rem analyse exo-type ?values) + "lux i64 <" (analyse-int-lt analyse exo-type ?values) + "lux i64 f64" (analyse-int-frac analyse exo-type ?values) + "lux i64 char" (analyse-int-char analyse exo-type ?values) "lux f64 +" (analyse-frac-add analyse exo-type ?values) "lux f64 -" (analyse-frac-sub analyse exo-type ?values) diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj index bf1ca306e..88b989262 100644 --- a/luxc/src/lux/compiler/jvm/proc/common.clj +++ b/luxc/src/lux/compiler/jvm/proc/common.clj @@ -448,18 +448,15 @@ "logical-right-shift" (compile-i64-logical-right-shift compile ?values special-args) "=" (compile-i64-eq compile ?values special-args) "+" (compile-i64-add compile ?values special-args) - "-" (compile-i64-sub compile ?values special-args)) - - "int" - (case proc - "*" (compile-int-mul compile ?values special-args) - "/" (compile-int-div compile ?values special-args) - "%" (compile-int-rem compile ?values special-args) - "<" (compile-int-lt compile ?values special-args) - "f64" (compile-int-frac compile ?values special-args) - "char" (compile-int-char compile ?values special-args) + "-" (compile-i64-sub compile ?values special-args) + "*" (compile-int-mul compile ?values special-args) + "/" (compile-int-div compile ?values special-args) + "%" (compile-int-rem compile ?values special-args) + "<" (compile-int-lt compile ?values special-args) + "f64" (compile-int-frac compile ?values special-args) + "char" (compile-int-char compile ?values special-args) ) - + "f64" (case proc "+" (compile-frac-add compile ?values special-args) diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux index e9a72b2f1..ea67a0d4a 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux @@ -79,9 +79,9 @@ maskI (_.unwrap #_t.Long) (_.wrap #_t.Long)))] - [bit::and _.LAND] - [bit::or _.LOR] - [bit::xor _.LXOR] + [i64::and _.LAND] + [i64::or _.LOR] + [i64::xor _.LXOR] ) (template [ ] @@ -92,9 +92,9 @@ (_.wrap #_t.Long)))] - [bit::left-shift _.LSHL] - [bit::arithmetic-right-shift _.LSHR] - [bit::logical-right-shift _.LUSHR] + [i64::left-shift _.LSHL] + [i64::arithmetic-right-shift _.LSHR] + [i64::logical-right-shift _.LUSHR] ) (template [ ] @@ -117,9 +117,9 @@ [i64::+ #_t.Long _.LADD] [i64::- #_t.Long _.LSUB] - [int::* #_t.Long _.LMUL] - [int::/ #_t.Long _.LDIV] - [int::% #_t.Long _.LREM] + [i64::* #_t.Long _.LMUL] + [i64::/ #_t.Long _.LDIV] + [i64::% #_t.Long _.LREM] [frac::+ #_t.Double _.DADD] [frac::- #_t.Double _.DSUB] @@ -141,7 +141,7 @@ [ +0] [ -1])] - [i64::= int::< (_.unwrap #_t.Long) _.LCMP] + [i64::= i64::< (_.unwrap #_t.Long) _.LCMP] [frac::= frac::< (_.unwrap #_t.Double) _.DCMPG] ) @@ -150,8 +150,8 @@ (Unary Inst) (|>> inputI ))] - [int::f64 (_.unwrap #_t.Long) (<| (_.wrap #_t.Double) _.L2D)] - [int::char (_.unwrap #_t.Long) + [i64::f64 (_.unwrap #_t.Long) (<| (_.wrap #_t.Double) _.L2D)] + [i64::char (_.unwrap #_t.Long) ((|>> _.L2I _.I2C (_.INVOKESTATIC "java.lang.Character" "toString" (_t.method (list _t.char) (#.Some $String) (list)) #0)))] [frac::i64 (_.unwrap #_t.Double) (<| (_.wrap #_t.Long) _.D2L)] @@ -258,26 +258,21 @@ Bundle (<| (bundle.prefix "i64") (|> (: Bundle bundle.empty) - (bundle.install "and" (binary bit::and)) - (bundle.install "or" (binary bit::or)) - (bundle.install "xor" (binary bit::xor)) - (bundle.install "left-shift" (binary bit::left-shift)) - (bundle.install "logical-right-shift" (binary bit::logical-right-shift)) - (bundle.install "arithmetic-right-shift" (binary bit::arithmetic-right-shift)) + (bundle.install "and" (binary i64::and)) + (bundle.install "or" (binary i64::or)) + (bundle.install "xor" (binary i64::xor)) + (bundle.install "left-shift" (binary i64::left-shift)) + (bundle.install "logical-right-shift" (binary i64::logical-right-shift)) + (bundle.install "arithmetic-right-shift" (binary i64::arithmetic-right-shift)) + (bundle.install "=" (binary i64::=)) + (bundle.install "<" (binary i64::<)) (bundle.install "+" (binary i64::+)) (bundle.install "-" (binary i64::-)) - (bundle.install "=" (binary i64::=))))) - -(def: bundle::int - Bundle - (<| (bundle.prefix "int") - (|> (: Bundle bundle.empty) - (bundle.install "*" (binary int::*)) - (bundle.install "/" (binary int::/)) - (bundle.install "%" (binary int::%)) - (bundle.install "<" (binary int::<)) - (bundle.install "f64" (unary int::f64)) - (bundle.install "char" (unary int::char))))) + (bundle.install "*" (binary i64::*)) + (bundle.install "/" (binary i64::/)) + (bundle.install "%" (binary i64::%)) + (bundle.install "f64" (unary i64::f64)) + (bundle.install "char" (unary i64::char))))) (def: bundle::f64 Bundle @@ -323,7 +318,6 @@ (<| (bundle.prefix "lux") (|> bundle::lux (dictionary.merge bundle::i64) - (dictionary.merge bundle::int) (dictionary.merge bundle::f64) (dictionary.merge bundle::text) (dictionary.merge bundle::io)))) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index be997fc2e..0e231eb3a 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -6,11 +6,11 @@ (0)))]) ("lux def" double-quote - ("lux int char" +34) + ("lux i64 char" +34) [dummy-cursor (10 (0))]) ("lux def" new-line - ("lux int char" +10) + ("lux i64 char" +10) [dummy-cursor (10 (0))]) ("lux def" __paragraph @@ -1160,7 +1160,7 @@ #.Nil)) (#Function Nat (#Function Nat Nat)) ("lux coerce" Nat - ("lux int *" + ("lux i64 *" ("lux coerce" Int param) ("lux coerce" Int subject)))) @@ -2238,10 +2238,10 @@ (-> Nat Nat Bit) (let' [referenceH (high-bits reference) sampleH (high-bits sample)] - (if ("lux int <" referenceH sampleH) + (if ("lux i64 <" referenceH sampleH) #1 (if ("lux i64 =" referenceH sampleH) - ("lux int <" + ("lux i64 <" (low-bits reference) (low-bits sample)) #0)))) @@ -2370,7 +2370,7 @@ #1 ( reference sample)))] - [ Int "lux i64 =" "lux int <" i/= i/< i/<= i/> i/>= + [ Int "lux i64 =" "lux i64 <" i/= i/< i/<= i/> i/>= "Int(eger) equivalence." "Int(eger) less-than." "Int(eger) less-than-equal." "Int(eger) greater-than." "Int(eger) greater-than-equal."] [Frac "lux f64 =" "lux f64 <" f/= f/< f/<= f/> f/>= @@ -2381,15 +2381,15 @@ (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) division.")]) (-> Nat Nat Nat) - (if ("lux int <" +0 ("lux coerce" Int param)) + (if ("lux i64 <" +0 ("lux coerce" Int param)) (if (n/< param subject) 0 1) (let' [quotient (|> subject ("lux i64 logical-right-shift" 1) - ("lux int /" ("lux coerce" Int param)) + ("lux i64 /" ("lux coerce" Int param)) ("lux i64 left-shift" 1)) - flat ("lux int *" + flat ("lux i64 *" ("lux coerce" Int param) ("lux coerce" Int quotient)) remainder ("lux i64 -" flat subject)] @@ -2402,7 +2402,7 @@ (text$ "Nat(ural) [division remainder].")]) (-> Nat Nat (#Product Nat Nat)) (let' [div (n// param subject) - flat ("lux int *" + flat ("lux i64 *" ("lux coerce" Int param) ("lux coerce" Int div))] [div ("lux i64 -" flat subject)])) @@ -2411,7 +2411,7 @@ (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) remainder.")]) (-> Nat Nat Nat) - (let' [flat ("lux int *" + (let' [flat ("lux i64 *" ("lux coerce" Int param) ("lux coerce" Int (n// param subject)))] ("lux i64 -" flat subject))) @@ -2437,9 +2437,9 @@ (-> ) ( param subject))] - [ Int i/* "lux int *" "Int(eger) multiplication."] - [ Int i// "lux int /" "Int(eger) division."] - [ Int i/% "lux int %" "Int(eger) remainder."] + [ Int i/* "lux i64 *" "Int(eger) multiplication."] + [ Int i// "lux i64 /" "Int(eger) division."] + [ Int i/% "lux i64 %" "Int(eger) remainder."] [Frac f/+ "lux f64 +" "Frac(tion) addition."] [Frac f/- "lux f64 -" "Frac(tion) substraction."] @@ -2457,12 +2457,12 @@ paramH (high-bits param) paramL (low-bits param) bottom (|> subjectL - ("lux int *" paramL) + ("lux i64 *" paramL) ("lux i64 logical-right-shift" 32)) middle ("lux i64 +" - ("lux int *" paramL subjectH) - ("lux int *" paramH subjectL)) - top ("lux int *" subjectH paramH)] + ("lux i64 *" paramL subjectH) + ("lux i64 *" paramH subjectL)) + top ("lux i64 *" subjectH paramH)] (|> bottom ("lux i64 +" middle) high-bits @@ -2495,8 +2495,8 @@ shift ("lux i64 -" trailing-zeroes 64) numerator ("lux i64 left-shift" shift 1)] (|> ("lux coerce" Int numerator) - ("lux int /" ("lux coerce" Int denominator)) - ("lux int *" ("lux coerce" Int subject)) + ("lux i64 /" ("lux coerce" Int denominator)) + ("lux i64 *" ("lux coerce" Int subject)) ("lux coerce" Rev))))) (def:''' #export (r/% param subject) @@ -2512,7 +2512,7 @@ (text$ "Rev(olution) scale.")]) (-> Nat Rev Rev) (|> ("lux coerce" Int subject) - ("lux int *" ("lux coerce" Int param)) + ("lux i64 *" ("lux coerce" Int param)) ("lux coerce" Rev))) (def:''' #export (r/reciprocal numerator) @@ -5184,7 +5184,7 @@ ( n))] [frac-to-int Frac Int "lux f64 i64"] - [int-to-frac Int Frac "lux int f64"] + [int-to-frac Int Frac "lux i64 f64"] ) (def: (find-baseline-column code) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 856481560..a9cec1526 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -21,7 +21,7 @@ ## (The JVM specifies chars as 16-bit unsigned integers) (def: #export from-code (-> Char Text) - (|>> (:coerce Int) "lux int char")) + (|>> (:coerce Int) "lux i64 char")) (template [ ] [(def: #export (from-code )) diff --git a/stdlib/source/lux/tool/compiler/default/syntax.lux b/stdlib/source/lux/tool/compiler/default/syntax.lux index 788a492cd..e63fd742f 100644 --- a/stdlib/source/lux/tool/compiler/default/syntax.lux +++ b/stdlib/source/lux/tool/compiler/default/syntax.lux @@ -80,7 +80,7 @@ ( reference subject))] [!n/= "lux i64 ="] - [!i/< "lux int <"] + [!i/< "lux i64 <"] ) (template [ ] diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux index 7afbb3331..dd645886f 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux @@ -160,18 +160,13 @@ (///bundle.install "left-shift" (binary Nat I64* I64)) (///bundle.install "logical-right-shift" (binary Nat I64* I64)) (///bundle.install "arithmetic-right-shift" (binary Nat I64* I64)) + (///bundle.install "=" (binary I64* I64* Bit)) + (///bundle.install "<" (binary Int Int Bit)) (///bundle.install "+" (binary I64* I64* I64)) (///bundle.install "-" (binary I64* I64* I64)) - (///bundle.install "=" (binary I64* I64* Bit))))) - -(def: bundle::int - Bundle - (<| (///bundle.prefix "int") - (|> ///bundle.empty (///bundle.install "*" (binary Int Int Int)) (///bundle.install "/" (binary Int Int Int)) (///bundle.install "%" (binary Int Int Int)) - (///bundle.install "<" (binary Int Int Bit)) (///bundle.install "f64" (unary Int Frac)) (///bundle.install "char" (unary Int Text))))) @@ -212,7 +207,6 @@ (|> ///bundle.empty (dictionary.merge (bundle::lux eval)) (dictionary.merge bundle::i64) - (dictionary.merge bundle::int) (dictionary.merge bundle::f64) (dictionary.merge bundle::text) (dictionary.merge bundle::io) diff --git a/stdlib/source/spec/compositor/generation/common.lux b/stdlib/source/spec/compositor/generation/common.lux index 8ed524efe..c837c30a3 100644 --- a/stdlib/source/spec/compositor/generation/common.lux +++ b/stdlib/source/spec/compositor/generation/common.lux @@ -86,11 +86,11 @@ false) (let [subject ])))] - ["lux i64 to-f64" Frac int-to-frac f/= subject] - ["lux i64 char" Text (|>> (:coerce Nat) text.from-code) text@= (|> subject - (:coerce Nat) - (n/% (i64.left-shift 8 1)) - (:coerce Int))] + ["lux i64 f64" Frac int-to-frac f/= subject] + ["lux i64 char" Text (|>> (:coerce Nat) text.from-code) text@= (|> subject + (:coerce Nat) + (n/% (i64.left-shift 8 1)) + (:coerce Int))] )) (~~ (template [ ] [(_.test @@ -270,7 +270,7 @@ (run (..sanitize "lux text char")) (case> (^multi (#error.Success valueV) [(:coerce (Maybe Int) valueV) (#.Some valueV)]) - (text.contains? ("lux int char" valueV) + (text.contains? ("lux i64 char" valueV) sample-lower) _ diff --git a/stdlib/source/test/lux/tool/compiler/phase/extension/analysis/common.lux b/stdlib/source/test/lux/tool/compiler/phase/extension/analysis/common.lux index b6f7fb10c..e45656025 100644 --- a/stdlib/source/test/lux/tool/compiler/phase/extension/analysis/common.lux +++ b/stdlib/source/test/lux/tool/compiler/phase/extension/analysis/common.lux @@ -99,17 +99,17 @@ paramC (|> r.int (:: @ map code.int))] ($_ _.and (_.test "Can multiply integers." - (check-success+ "lux int *" (list paramC subjectC) Int)) + (check-success+ "lux i64 *" (list paramC subjectC) Int)) (_.test "Can divide integers." - (check-success+ "lux int /" (list paramC subjectC) Int)) + (check-success+ "lux i64 /" (list paramC subjectC) Int)) (_.test "Can calculate remainder of integers." - (check-success+ "lux int %" (list paramC subjectC) Int)) + (check-success+ "lux i64 %" (list paramC subjectC) Int)) (_.test "Can compare integers." - (check-success+ "lux int <" (list paramC subjectC) Bit)) + (check-success+ "lux i64 <" (list paramC subjectC) Bit)) (_.test "Can convert integer to text." - (check-success+ "lux int char" (list subjectC) Text)) + (check-success+ "lux i64 char" (list subjectC) Text)) (_.test "Can convert integer to fraction." - (check-success+ "lux int frac" (list subjectC) Frac)) + (check-success+ "lux i64 f64" (list subjectC) Frac)) ))) (def: frac -- cgit v1.2.3