From 69fefab57c40f323d759dc444dbcebad15071585 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 13 Jul 2018 22:01:32 -0400 Subject: Re-named "Bool" type to "Bit". --- new-luxc/source/luxc/lang/host/common-lisp.lux | 2 +- new-luxc/source/luxc/lang/host/jvm.lux | 2 +- new-luxc/source/luxc/lang/host/jvm/def.lux | 2 +- new-luxc/source/luxc/lang/host/jvm/inst.lux | 4 +-- new-luxc/source/luxc/lang/host/lua.lux | 2 +- new-luxc/source/luxc/lang/host/php.lux | 8 +++-- new-luxc/source/luxc/lang/host/python.lux | 2 +- new-luxc/source/luxc/lang/host/r.lux | 2 +- new-luxc/source/luxc/lang/host/ruby.lux | 14 +++++---- new-luxc/source/luxc/lang/synthesis/variable.lux | 2 +- .../luxc/lang/translation/common-lisp/case.jvm.lux | 4 +-- .../luxc/lang/translation/common-lisp/eval.jvm.lux | 2 +- .../translation/common-lisp/expression.jvm.lux | 4 +-- .../lang/translation/common-lisp/primitive.jvm.lux | 4 +-- .../lang/translation/common-lisp/runtime.jvm.lux | 4 +-- .../lang/translation/common-lisp/structure.jvm.lux | 2 +- .../source/luxc/lang/translation/js/case.jvm.lux | 4 +-- .../luxc/lang/translation/js/expression.jvm.lux | 4 +-- .../luxc/lang/translation/js/primitive.jvm.lux | 4 +-- .../luxc/lang/translation/js/runtime.jvm.lux | 4 +-- .../luxc/lang/translation/js/structure.jvm.lux | 2 +- .../source/luxc/lang/translation/jvm/case.jvm.lux | 2 +- .../luxc/lang/translation/jvm/expression.jvm.lux | 6 ++-- .../luxc/lang/translation/jvm/function.jvm.lux | 2 +- .../luxc/lang/translation/jvm/imports.jvm.lux | 4 +-- .../source/luxc/lang/translation/jvm/loop.jvm.lux | 2 +- .../luxc/lang/translation/jvm/primitive.jvm.lux | 4 +-- .../lang/translation/jvm/procedure/host.jvm.lux | 16 ++++++---- .../luxc/lang/translation/jvm/structure.jvm.lux | 4 +-- .../source/luxc/lang/translation/lua/case.jvm.lux | 4 +-- .../luxc/lang/translation/lua/expression.jvm.lux | 4 +-- .../luxc/lang/translation/lua/primitive.jvm.lux | 8 ++--- .../luxc/lang/translation/lua/runtime.jvm.lux | 4 +-- .../luxc/lang/translation/lua/structure.jvm.lux | 2 +- .../source/luxc/lang/translation/php/case.jvm.lux | 6 ++-- .../luxc/lang/translation/php/expression.jvm.lux | 4 +-- .../luxc/lang/translation/php/primitive.jvm.lux | 4 +-- .../luxc/lang/translation/php/runtime.jvm.lux | 4 +-- .../luxc/lang/translation/php/structure.jvm.lux | 2 +- .../luxc/lang/translation/python/case.jvm.lux | 6 ++-- .../lang/translation/python/expression.jvm.lux | 4 +-- .../luxc/lang/translation/python/primitive.jvm.lux | 4 +-- .../luxc/lang/translation/python/runtime.jvm.lux | 4 +-- .../luxc/lang/translation/python/structure.jvm.lux | 2 +- .../source/luxc/lang/translation/r/case.jvm.lux | 4 +-- .../luxc/lang/translation/r/expression.jvm.lux | 4 +-- .../luxc/lang/translation/r/primitive.jvm.lux | 4 +-- .../source/luxc/lang/translation/r/runtime.jvm.lux | 4 +-- .../luxc/lang/translation/r/structure.jvm.lux | 2 +- .../source/luxc/lang/translation/ruby/case.jvm.lux | 4 +-- .../luxc/lang/translation/ruby/expression.jvm.lux | 4 +-- .../luxc/lang/translation/ruby/primitive.jvm.lux | 8 ++--- .../luxc/lang/translation/ruby/runtime.jvm.lux | 4 +-- .../luxc/lang/translation/ruby/structure.jvm.lux | 2 +- .../luxc/lang/translation/scheme/eval.jvm.lux | 2 +- new-luxc/test/test/luxc/lang/analysis/host.jvm.lux | 12 ++++---- new-luxc/test/test/luxc/lang/analysis/type.lux | 6 ++-- new-luxc/test/test/luxc/lang/synthesis/loop.lux | 34 +++++++++++----------- new-luxc/test/test/luxc/lang/translation/case.lux | 8 ++--- .../test/test/luxc/lang/translation/common.lux | 20 ++++++------- new-luxc/test/test/luxc/lang/translation/js.lux | 6 ++-- new-luxc/test/test/luxc/lang/translation/jvm.lux | 24 +++++++-------- .../test/test/luxc/lang/translation/primitive.lux | 6 ++-- .../test/test/luxc/lang/translation/structure.lux | 4 +-- 64 files changed, 176 insertions(+), 166 deletions(-) (limited to 'new-luxc') diff --git a/new-luxc/source/luxc/lang/host/common-lisp.lux b/new-luxc/source/luxc/lang/host/common-lisp.lux index 77b8cfc22..fb6a933df 100644 --- a/new-luxc/source/luxc/lang/host/common-lisp.lux +++ b/new-luxc/source/luxc/lang/host/common-lisp.lux @@ -53,7 +53,7 @@ (:abstraction "()")) (def: #export bool - (-> Bool Expression) + (-> Bit Expression) (|>> (case> true (:abstraction "t") false ..nil))) diff --git a/new-luxc/source/luxc/lang/host/jvm.lux b/new-luxc/source/luxc/lang/host/jvm.lux index d30df3fd3..3c5fa3150 100644 --- a/new-luxc/source/luxc/lang/host/jvm.lux +++ b/new-luxc/source/luxc/lang/host/jvm.lux @@ -97,7 +97,7 @@ options)] (wrap (list& (` (type: (~' #export) (~ g!type) (~ (code.record (list/map (function (_ tag) - [tag (` .Bool)]) + [tag (` .Bit)]) g!tags+))))) (` (def: (~' #export) (~ g!none) diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux index c973f79c3..4c19f38f6 100644 --- a/new-luxc/source/luxc/lang/host/jvm/def.lux +++ b/new-luxc/source/luxc/lang/host/jvm/def.lux @@ -265,7 +265,7 @@ (FieldVisitor::visitEnd []))] writer)))] - [boolean-field Bool $t.boolean id] + [boolean-field Bit $t.boolean id] [byte-field Int $t.byte host.long-to-byte] [short-field Int $t.short host.long-to-short] [int-field Int $t.int host.long-to-int] diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux index c3088ec7d..3f0f68def 100644 --- a/new-luxc/source/luxc/lang/host/jvm/inst.lux +++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux @@ -127,7 +127,7 @@ (do-to visitor (MethodVisitor::visitLdcInsn [( value)]))))] - [boolean Bool id] + [boolean Bit id] [int Int host.long-to-int] [long Int id] [double Frac id] @@ -259,7 +259,7 @@ (do-template [ ] [(def: #export ( class method-name method-signature interface?) - (-> Text Text //.Method Bool //.Inst) + (-> Text Text //.Method Bit //.Inst) (function (_ visitor) (do-to visitor (MethodVisitor::visitMethodInsn [ (//type.binary-name class) method-name (//type.method-descriptor method-signature) interface?]))))] diff --git a/new-luxc/source/luxc/lang/host/lua.lux b/new-luxc/source/luxc/lang/host/lua.lux index 8f057bc29..ec2fa8928 100644 --- a/new-luxc/source/luxc/lang/host/lua.lux +++ b/new-luxc/source/luxc/lang/host/lua.lux @@ -15,7 +15,7 @@ "nil") (def: #export bool - (-> Bool Expression) + (-> Bit Expression) %b) (def: #export int diff --git a/new-luxc/source/luxc/lang/host/php.lux b/new-luxc/source/luxc/lang/host/php.lux index 50d618f85..34c7c0535 100644 --- a/new-luxc/source/luxc/lang/host/php.lux +++ b/new-luxc/source/luxc/lang/host/php.lux @@ -23,7 +23,7 @@ (type: #export Global (Code' (Expression' Global'))) (type: #export Var (Code' (Expression' Var'))) (type: #export Argument - {#reference? Bool + {#reference? Bit #var Var}) (type: #export Computation (Code' (Expression' Computation'))) (type: #export Statement (Code' Statement')) @@ -82,8 +82,10 @@ (:abstraction "NULL")) (def: #export bool - (-> Bool Computation) - (|>> %b :abstraction)) + (-> Bit Computation) + (|>> (case> true "true" + false "false") + :abstraction)) (def: #export int (-> Int Computation) diff --git a/new-luxc/source/luxc/lang/host/python.lux b/new-luxc/source/luxc/lang/host/python.lux index c9835aa5d..e39ce5571 100644 --- a/new-luxc/source/luxc/lang/host/python.lux +++ b/new-luxc/source/luxc/lang/host/python.lux @@ -48,7 +48,7 @@ (:abstraction "None")) (def: #export bool - (-> Bool Expression) + (-> Bit Expression) (|>> (case> true "True" false "False") :abstraction)) diff --git a/new-luxc/source/luxc/lang/host/r.lux b/new-luxc/source/luxc/lang/host/r.lux index 6667d531f..4655c1343 100644 --- a/new-luxc/source/luxc/lang/host/r.lux +++ b/new-luxc/source/luxc/lang/host/r.lux @@ -66,7 +66,7 @@ (def: #export no-answer Expression n/a) (def: #export bool - (-> Bool Expression) + (-> Bit Expression) (|>> (case> true "TRUE" false "FALSE") self-contained)) diff --git a/new-luxc/source/luxc/lang/host/ruby.lux b/new-luxc/source/luxc/lang/host/ruby.lux index c2bc6e95f..51b0d7ea7 100644 --- a/new-luxc/source/luxc/lang/host/ruby.lux +++ b/new-luxc/source/luxc/lang/host/ruby.lux @@ -1,8 +1,11 @@ (.module: [lux #- not or and] - (lux (data [text] - text/format - (coll [list "list/" Functor Fold])))) + (lux + (control + pipe) + (data [text] + text/format + (coll [list "list/" Functor Fold])))) (type: #export Ruby Text) @@ -15,8 +18,9 @@ "nil") (def: #export bool - (-> Bool Expression) - %b) + (-> Bit Expression) + (|>> (case> true "true" + false "false"))) (def: #export int (-> Int Expression) diff --git a/new-luxc/source/luxc/lang/synthesis/variable.lux b/new-luxc/source/luxc/lang/synthesis/variable.lux index 4a3317d9f..f6a45b02e 100644 --- a/new-luxc/source/luxc/lang/synthesis/variable.lux +++ b/new-luxc/source/luxc/lang/synthesis/variable.lux @@ -35,7 +35,7 @@ (list))) (def: (non-arg? arity var) - (-> ls.Arity Variable Bool) + (-> ls.Arity Variable Bit) (and (variableL.local? var) (n/> arity (.nat var)))) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux index 9d781429e..373d23ae4 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux @@ -29,7 +29,7 @@ bodyO)))) (def: #export (translate-record-get translate valueS pathP) - (-> (-> Synthesis (Meta Expression)) Synthesis (List [Nat Bool]) + (-> (-> Synthesis (Meta Expression)) Synthesis (List [Nat Bit]) (Meta Expression)) (do macro.Monad [valueO (translate valueS)] @@ -115,7 +115,7 @@ [_ ( value)] (meta/wrap (_.when (|> value (<=> cursor-top) _.not) fail-pm!))) - ([#.Bool _.bool _.equal] + ([#.Bit _.bool _.equal] [#.Nat (<| _.int (:coerce Int)) _.=] [#.Int _.int _.=] [#.Rev (<| _.int (:coerce Int)) _.=] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux index a10fa0d5d..c88e83ed5 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux @@ -85,7 +85,7 @@ (#e.Success output))))) (def: (variant tag flag value) - (-> Nat Bool Any Any) + (-> Nat Bit Any Any) [(Long::intValue [] (:coerce Long tag)) (: Any (if flag diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux index 4e0c617b4..d3761ff6b 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux @@ -38,14 +38,14 @@ (^template [ ] [_ ( value)] ( value)) - ([#.Bool primitiveT.translate-bool] + ([#.Bit primitiveT.translate-bit] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) (^code [(~ singleton)]) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux index 1c8c17bed..7556e6ebb 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux @@ -5,8 +5,8 @@ [//] (// [".T" runtime])) -(def: #export translate-bool - (-> Bool (Meta Expression)) +(def: #export translate-bit + (-> Bit (Meta Expression)) (|>> _.bool meta/wrap)) (def: #export translate-int diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux index cd12328e2..43c1fd2a0 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux @@ -19,7 +19,7 @@ (def: #export unit Expression (_.string //.unit)) (def: (flag value) - (-> Bool Expression) + (-> Bit Expression) (if value (_.string "") _.nil)) @@ -32,7 +32,7 @@ value)) (def: #export (variant tag last? value) - (-> Nat Bool Expression Expression) + (-> Nat Bit Expression Expression) (variant' (_.int (:coerce Int tag)) (flag last?) value)) (def: #export none diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux index fe7009627..dcf7e5693 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux @@ -25,7 +25,7 @@ (wrap (_.vector elemsT+))))) (def: #export (translate-variant translate tag tail? valueS) - (-> (-> Synthesis (Meta Expression)) Nat Bool Synthesis (Meta Expression)) + (-> (-> Synthesis (Meta Expression)) Nat Bit Synthesis (Meta Expression)) (do macro.Monad [valueT (translate valueS)] (wrap (runtimeT.variant tag tail? valueT)))) diff --git a/new-luxc/source/luxc/lang/translation/js/case.jvm.lux b/new-luxc/source/luxc/lang/translation/js/case.jvm.lux index fc01a9d7c..e8fdcb00c 100644 --- a/new-luxc/source/luxc/lang/translation/js/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/case.jvm.lux @@ -25,7 +25,7 @@ "})()")))) (def: #export (translate-record-get translate valueS path) - (-> (-> ls.Synthesis (Meta Expression)) ls.Synthesis (List [Nat Bool]) + (-> (-> ls.Synthesis (Meta Expression)) ls.Synthesis (List [Nat Bit]) (Meta Expression)) (do macro.Monad [valueJS (translate valueS)] @@ -105,7 +105,7 @@ (^template [ ] [_ ( value)] (meta/wrap (format "if(" peek-cursor " !== " ( value) ") { " fail-pattern-matching " }"))) - ([#.Bool %b] + ([#.Bit %b] [#.Frac %f] [#.Text %t]) diff --git a/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux index 8a5e73c75..544dd1eca 100644 --- a/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux @@ -42,14 +42,14 @@ (^template [ ] [_ ( value)] ( value)) - ([#.Bool primitiveT.translate-bool] + ([#.Bit primitiveT.translate-bit] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) (^code [(~+ members)]) diff --git a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux index 753f1ce45..e69291007 100644 --- a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux @@ -9,8 +9,8 @@ (// [".T" runtime]) (luxc (lang (host [js #+ JS Expression Statement])))) -(def: #export translate-bool - (-> Bool (Meta Expression)) +(def: #export translate-bit + (-> Bit (Meta Expression)) (|>> %b meta/wrap)) (def: low-mask Nat (dec (bit.left-shift +32 +1))) diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux index 9840bba1f..8adfd22bf 100644 --- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux @@ -14,7 +14,7 @@ (def: #export unit Expression (%t //.unit)) (def: (flag value) - (-> Bool JS) + (-> Bit JS) (if value (%t "") "null")) @@ -26,7 +26,7 @@ [//.variant-value-field value]))) (def: #export (variant tag last? value) - (-> Nat Bool Expression Expression) + (-> Nat Bit Expression Expression) (variant' (%i (.int tag)) (flag last?) value)) (def: none diff --git a/new-luxc/source/luxc/lang/translation/js/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/js/structure.jvm.lux index df7215dba..580f48807 100644 --- a/new-luxc/source/luxc/lang/translation/js/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/structure.jvm.lux @@ -25,7 +25,7 @@ (wrap (format "[" (text.join-with "," elemsT+) "]"))))) (def: #export (translate-variant translate tag tail? valueS) - (-> (-> Synthesis (Meta Expression)) Nat Bool Synthesis (Meta Expression)) + (-> (-> Synthesis (Meta Expression)) Nat Bit Synthesis (Meta Expression)) (do macro.Monad [valueT (translate valueS)] (wrap (runtimeT.variant tag tail? valueT)))) diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux index 18309b0e5..d29b9ae7c 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux @@ -73,7 +73,7 @@ (macro/wrap (|>> peekI ($i.ASTORE register))) - [_ (#.Bool value)] + [_ (#.Bit value)] (macro/wrap (let [jumpI (if value $i.IFEQ $i.IFNE)] (|>> peekI ($i.unwrap #$.Boolean) diff --git a/new-luxc/source/luxc/lang/translation/jvm/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/expression.jvm.lux index a587d2e5b..b6fed434e 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/expression.jvm.lux @@ -32,8 +32,8 @@ (def: #export (translate synthesis) (-> Synthesis (Meta $.Inst)) (case synthesis - (^ (//synthesis.bool value)) - (primitiveT.translate-bool value) + (^ (//synthesis.bit value)) + (primitiveT.translate-bit value) (^ (//synthesis.i64 value)) (primitiveT.translate-i64 value) @@ -44,7 +44,7 @@ (^ (//synthesis.text value)) (primitiveT.translate-text value) - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) (^code [(~+ members)]) diff --git a/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux index 70eedf738..062cf5d52 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux @@ -23,7 +23,7 @@ (def: $Object $.Type ($t.class "java.lang.Object" (list))) (def: (poly-arg? arity) - (-> ls.Arity Bool) + (-> ls.Arity Bit) (n/> +1 arity)) (def: (reset-method class) diff --git a/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux index 22fdfbece..820024153 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux @@ -66,7 +66,7 @@ (<| (Future::get []) promise-to-future (do promise.Monad - [[new? future] (stm.commit (: (STM [Bool (CompletableFuture (Error Lux))]) + [[new? future] (stm.commit (: (STM [Bit (CompletableFuture (Error Lux))]) (do stm.Monad [current-compilations (stm.read compilations)] (case (dict.get dependency current-compilations) @@ -87,7 +87,7 @@ (wrap future))))) (def: compiled? - (-> Module Bool) + (-> Module Bit) (|>> (get@ #.module-state) (case> (^or #.Cached #.Compiled) diff --git a/new-luxc/source/luxc/lang/translation/jvm/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/loop.jvm.lux index f48ab149a..120a3e384 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/loop.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/loop.jvm.lux @@ -19,7 +19,7 @@ [".T" reference])) (def: (constant? register changeS) - (-> Register ls.Synthesis Bool) + (-> Register ls.Synthesis Bit) (case changeS (^multi (^code ((~ [_ (#.Int var)]))) (i/= (variableL.local register) diff --git a/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux index 80a243852..250b0db52 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux @@ -12,8 +12,8 @@ ["ls" synthesis])) (// [".T" common])) -(def: #export (translate-bool value) - (-> Bool (Meta $.Inst)) +(def: #export (translate-bit value) + (-> Bit (Meta $.Inst)) (macro/wrap ($i.GETSTATIC "java.lang.Boolean" (if value "TRUE" "FALSE") ($t.class "java.lang.Boolean" (list))))) diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux index f6a0069f5..45cb67fb9 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux @@ -155,6 +155,10 @@ [double//% $i.DREM #$.Double #$.Double #$.Double] ) +(def: boolean-class ($t.class "java.lang.Boolean" (list))) +(def: falseI ($i.GETSTATIC "java.lang.Boolean" "FALSE" boolean-class)) +(def: trueI ($i.GETSTATIC "java.lang.Boolean" "TRUE" boolean-class)) + (do-template [ ] [(def: ( [xI yI]) @.Binary @@ -163,10 +167,10 @@ (|>> xI ($i.unwrap ) yI ($i.unwrap ) ( @then) - ($i.GETSTATIC "java.lang.Boolean" "FALSE" ($t.class "java.lang.Boolean" (list))) + falseI ($i.GOTO @end) ($i.label @then) - ($i.GETSTATIC "java.lang.Boolean" "TRUE" ($t.class "java.lang.Boolean" (list))) + trueI ($i.label @end))))] [int//= $i.IF_ICMPEQ #$.Int #$.Int #$.Boolean] @@ -186,10 +190,10 @@ ($i.int ) ($i.IF_ICMPEQ @then) - ($i.GETSTATIC "java.lang.Boolean" "FALSE" ($t.class "java.lang.Boolean" (list))) + falseI ($i.GOTO @end) ($i.label @then) - ($i.GETSTATIC "java.lang.Boolean" "TRUE" ($t.class "java.lang.Boolean" (list))) + trueI ($i.label @end))))] [long//= $i.LCMP 0 #$.Long #$.Long #$.Boolean] @@ -380,10 +384,10 @@ $i.with-label (function (_ @end)) (|>> objectI ($i.IFNULL @then) - ($i.GETSTATIC "java.lang.Boolean" "FALSE" ($t.class "java.lang.Boolean" (list))) + falseI ($i.GOTO @end) ($i.label @then) - ($i.GETSTATIC "java.lang.Boolean" "TRUE" ($t.class "java.lang.Boolean" (list))) + trueI ($i.label @end)))) (def: (object//synchronized [monitorI exprI]) diff --git a/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux index fce1c6790..9d3e4d097 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux @@ -42,13 +42,13 @@ membersI)))) (def: (flagI tail?) - (-> Bool $.Inst) + (-> Bit $.Inst) (if tail? ($i.string "") $i.NULL)) (def: #export (translate-variant translate tag tail? member) - (-> (-> ls.Synthesis (Meta $.Inst)) Nat Bool ls.Synthesis (Meta $.Inst)) + (-> (-> ls.Synthesis (Meta $.Inst)) Nat Bit ls.Synthesis (Meta $.Inst)) (do macro.Monad [memberI (translate member)] (wrap (|>> ($i.int (.int tag)) diff --git a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux index 70d2330f4..af4e61b7c 100644 --- a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux @@ -30,7 +30,7 @@ (lua.return! bodyO))))))) (def: #export (translate-record-get translate valueS path) - (-> (-> ls.Synthesis (Meta Expression)) ls.Synthesis (List [Nat Bool]) + (-> (-> ls.Synthesis (Meta Expression)) ls.Synthesis (List [Nat Bit]) (Meta Expression)) (do macro.Monad [valueO (translate valueS)] @@ -105,7 +105,7 @@ ([#.Nat (<| lua.int (:coerce Int))] [#.Int lua.int] [#.Rev (<| lua.int (:coerce Int))] - [#.Bool lua.bool] + [#.Bit lua.bool] [#.Frac lua.float] [#.Text lua.string]) diff --git a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux index 9632d5708..0fefcc8ba 100644 --- a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux @@ -42,14 +42,14 @@ (^template [ ] [_ ( value)] ( value)) - ([#.Bool primitiveT.translate-bool] + ([#.Bit primitiveT.translate-bit] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) (^code [(~+ members)]) diff --git a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux index 4a6c78b04..230498fcb 100644 --- a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux @@ -6,13 +6,13 @@ [macro "meta/" Monad]) (luxc (lang (host [lua #+ Lua Expression Statement])))) -(def: #export translate-bool - (-> Bool (Meta Expression)) - (|>> %b meta/wrap)) +(def: #export translate-bit + (-> Bit (Meta Expression)) + (|>> lua.bool meta/wrap)) (def: #export translate-int (-> Int (Meta Expression)) - (|>> %i meta/wrap)) + (|>> lua.int meta/wrap)) (def: #export translate-frac (-> Frac (Meta 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 2c0dfec17..6be20a0e6 100644 --- a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux @@ -17,7 +17,7 @@ (def: #export unit Expression (%t //.unit)) (def: (flag value) - (-> Bool Lua) + (-> Bit Lua) (if value (lua.string "") lua.nil)) @@ -29,7 +29,7 @@ [//.variant-value-field value]))) (def: #export (variant tag last? value) - (-> Nat Bool Expression Expression) + (-> Nat Bit Expression Expression) (variant' (%i (.int tag)) (flag last?) value)) (def: none diff --git a/new-luxc/source/luxc/lang/translation/lua/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/structure.jvm.lux index c629b0cae..b6eeaa013 100644 --- a/new-luxc/source/luxc/lang/translation/lua/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/structure.jvm.lux @@ -25,7 +25,7 @@ (wrap (format "{" (text.join-with "," elemsT+) "}"))))) (def: #export (translate-variant translate tag tail? valueS) - (-> (-> Synthesis (Meta Expression)) Nat Bool Synthesis (Meta Expression)) + (-> (-> Synthesis (Meta Expression)) Nat Bit Synthesis (Meta Expression)) (do macro.Monad [valueT (translate valueS)] (wrap (runtimeT.variant tag tail? valueT)))) diff --git a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux index 0e0aecb7d..c438425ff 100644 --- a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux @@ -31,7 +31,7 @@ (_.nth (_.int 1)))))) (def: #export (translate-record-get translate valueS pathP) - (-> (-> Synthesis (Meta Expression)) Synthesis (List [Nat Bool]) + (-> (-> Synthesis (Meta Expression)) Synthesis (List [Nat Bit]) (Meta Expression)) (do macro.Monad [valueO (translate valueS)] @@ -115,7 +115,7 @@ (meta/wrap (_.when! (_.not (_.= (|> value ) cursor-top)) fail-pm!))) ([#.Int _.int] - [#.Bool _.bool] + [#.Bit _.bool] [#.Frac _.float] [#.Text _.string]) @@ -196,7 +196,7 @@ ## TODO: Remove (let [inner recur]) once loops can have names. (let [inner recur] (case bodyS - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (inner valueS inner-variables) (^code [(~+ members)]) diff --git a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux index 420775734..b7f9661e7 100644 --- a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux @@ -36,12 +36,12 @@ (^template [ ] [_ ( value)] (|> value )) - ([#.Bool primitiveT.translate-bool] + ([#.Bit primitiveT.translate-bit] [#.Int primitiveT.translate-int] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) (^code [(~+ members)]) diff --git a/new-luxc/source/luxc/lang/translation/php/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/php/primitive.jvm.lux index 6fcd675ce..061833c70 100644 --- a/new-luxc/source/luxc/lang/translation/php/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/primitive.jvm.lux @@ -3,8 +3,8 @@ (lux [macro "meta/" Monad]) (luxc (lang (host ["_" php #+ Computation])))) -(def: #export translate-bool - (-> Bool (Meta Computation)) +(def: #export translate-bit + (-> Bit (Meta Computation)) (|>> _.bool meta/wrap)) (def: #export translate-int diff --git a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux index aeffe45e5..045f8ceb7 100644 --- a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux @@ -17,7 +17,7 @@ (def: #export unit Computation (_.string //.unit)) (def: (flag value) - (-> Bool Computation) + (-> Bit Computation) (if value (_.string "") _.null)) @@ -29,7 +29,7 @@ [(_.string //.variant-value-field) value]))) (def: #export (variant tag last? value) - (-> Nat Bool Expression Computation) + (-> Nat Bit Expression Computation) (variant' (_.int (.int tag)) (flag last?) value)) diff --git a/new-luxc/source/luxc/lang/translation/php/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/php/structure.jvm.lux index a92340e92..229b0e31d 100644 --- a/new-luxc/source/luxc/lang/translation/php/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/structure.jvm.lux @@ -25,7 +25,7 @@ (wrap (_.array/* elemsT+))))) (def: #export (translate-variant translate tag tail? valueS) - (-> //.Translator Nat Bool Synthesis (Meta Computation)) + (-> //.Translator Nat Bit Synthesis (Meta Computation)) (do macro.Monad [valueT (translate valueS)] (wrap (runtimeT.variant tag tail? valueT)))) 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 8e5b16a88..809b32c23 100644 --- a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux @@ -30,7 +30,7 @@ (python.apply (list valueO)))))) (def: #export (translate-record-get translate valueS pathP) - (-> (-> Synthesis (Meta Expression)) Synthesis (List [Nat Bool]) + (-> (-> Synthesis (Meta Expression)) Synthesis (List [Nat Bit]) (Meta Expression)) (do macro.Monad [valueO (translate valueS)] @@ -118,7 +118,7 @@ ([#.Nat (<| python.int (:coerce Int))] [#.Int python.int] [#.Rev (<| python.int (:coerce Int))] - [#.Bool python.bool] + [#.Bit python.bool] [#.Frac python.float] [#.Text python.string]) @@ -204,7 +204,7 @@ ## TODO: Remove (let [inner recur]) once loops can have names. (let [inner recur] (case bodyS - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (inner valueS inner-variables) (^code [(~+ members)]) diff --git a/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux index a1abe59a6..62be95f27 100644 --- a/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux @@ -41,14 +41,14 @@ (^template [ ] [_ ( value)] ( value)) - ([#.Bool primitiveT.translate-bool] + ([#.Bit primitiveT.translate-bit] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) (^code [(~+ members)]) diff --git a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux index 439404893..f88c34fce 100644 --- a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux @@ -3,8 +3,8 @@ (lux [macro "meta/" Monad]) (luxc (lang (host [python #+ Expression Statement])))) -(def: #export translate-bool - (-> Bool (Meta Expression)) +(def: #export translate-bit + (-> Bit (Meta Expression)) (|>> python.bool meta/wrap)) (def: #export translate-int 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 fbd599c77..70ce11a94 100644 --- a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux @@ -17,7 +17,7 @@ (def: #export unit Expression (python.string //.unit)) (def: (flag value) - (-> Bool Expression) + (-> Bit Expression) (if value (python.string "") python.none)) @@ -29,7 +29,7 @@ [(python.string //.variant-value-field) value]))) (def: #export (variant tag last? value) - (-> Nat Bool Expression Expression) + (-> Nat Bit Expression Expression) (variant' (python.int (.int tag)) (flag last?) value)) diff --git a/new-luxc/source/luxc/lang/translation/python/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/python/structure.jvm.lux index 0452ef504..158cf3a2c 100644 --- a/new-luxc/source/luxc/lang/translation/python/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/structure.jvm.lux @@ -25,7 +25,7 @@ (wrap (python.tuple elemsT+))))) (def: #export (translate-variant translate tag tail? valueS) - (-> (-> Synthesis (Meta Expression)) Nat Bool Synthesis (Meta Expression)) + (-> (-> Synthesis (Meta Expression)) Nat Bit Synthesis (Meta Expression)) (do macro.Monad [valueT (translate valueS)] (wrap (runtimeT.variant tag tail? valueT)))) diff --git a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux index fb16b8791..42460b620 100644 --- a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux @@ -31,7 +31,7 @@ bodyO))))) (def: #export (translate-record-get translate valueS pathP) - (-> (-> Synthesis (Meta Expression)) Synthesis (List [Nat Bool]) + (-> (-> Synthesis (Meta Expression)) Synthesis (List [Nat Bit]) (Meta Expression)) (do macro.Monad [valueO (translate valueS)] @@ -116,7 +116,7 @@ [_ ( value)] (meta/wrap (r.when (r.not (r.= (|> value ) cursor-top)) fail-pm!))) - ([#.Bool r.bool] + ([#.Bit r.bool] [#.Frac r.float] [#.Text r.string]) diff --git a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux index cd2227df3..2e30b4999 100644 --- a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux @@ -39,14 +39,14 @@ (^template [ ] [_ ( value)] ( value)) - ([#.Bool primitiveT.translate-bool] + ([#.Bit primitiveT.translate-bit] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) (^code [(~ singleton)]) diff --git a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux index 3652dfcfd..8bc7da848 100644 --- a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux @@ -5,8 +5,8 @@ [//] (// [".T" runtime])) -(def: #export translate-bool - (-> Bool (Meta Expression)) +(def: #export translate-bit + (-> Bit (Meta Expression)) (|>> r.bool meta/wrap)) (def: #export translate-int 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 9cab92115..cf0b87d78 100644 --- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux @@ -45,7 +45,7 @@ [//.int-low-field (r.int low)])))) (def: (flag value) - (-> Bool Expression) + (-> Bit Expression) (if value (r.string "") r.null)) @@ -57,7 +57,7 @@ [//.variant-value-field value]))) (def: #export (variant tag last? value) - (-> Nat Bool Expression Expression) + (-> Nat Bit Expression Expression) (variant' (r.int (.int tag)) (flag last?) value)) diff --git a/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux index bfe0a40a6..e9a528d2b 100644 --- a/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux @@ -25,7 +25,7 @@ (wrap (r.list elemsT+))))) (def: #export (translate-variant translate tag tail? valueS) - (-> (-> Synthesis (Meta Expression)) Nat Bool Synthesis (Meta Expression)) + (-> (-> Synthesis (Meta Expression)) Nat Bit Synthesis (Meta Expression)) (do macro.Monad [valueT (translate valueS)] (wrap (runtimeT.variant tag tail? valueT)))) diff --git a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux index 2cce1abf5..d83a5cd0a 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux @@ -30,7 +30,7 @@ (ruby.return! bodyO))))))) (def: #export (translate-record-get translate valueS path) - (-> (-> ls.Synthesis (Meta Expression)) ls.Synthesis (List [Nat Bool]) + (-> (-> ls.Synthesis (Meta Expression)) ls.Synthesis (List [Nat Bit]) (Meta Expression)) (do macro.Monad [valueO (translate valueS)] @@ -108,7 +108,7 @@ (meta/wrap (ruby.when! (ruby.not (ruby.= (|> value ) cursor-top)) (ruby.raise pm-error)))) ([#.Int ruby.int] - [#.Bool ruby.bool] + [#.Bit ruby.bool] [#.Frac ruby.float] [#.Text ruby.string]) diff --git a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux index 6d829f81c..e68cf8a8f 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux @@ -41,12 +41,12 @@ (^template [ ] [_ ( value)] ( value)) - ([#.Bool primitiveT.translate-bool] + ([#.Bit primitiveT.translate-bit] [#.Int primitiveT.translate-int] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) - (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) + (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bit last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) (^code [(~+ members)]) diff --git a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux index f84c700d4..cc5e5752e 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux @@ -6,13 +6,13 @@ [macro "meta/" Monad]) (luxc (lang (host [ruby #+ Ruby Expression Statement])))) -(def: #export translate-bool - (-> Bool (Meta Expression)) - (|>> %b meta/wrap)) +(def: #export translate-bit + (-> Bit (Meta Expression)) + (|>> ruby.bool meta/wrap)) (def: #export translate-int (-> Int (Meta Expression)) - (|>> %i meta/wrap)) + (|>> ruby.int meta/wrap)) (def: #export translate-frac (-> Frac (Meta 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 7e94101ff..9d0d0f890 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux @@ -17,7 +17,7 @@ (def: #export unit Expression (%t //.unit)) (def: (flag value) - (-> Bool Ruby) + (-> Bit Ruby) (if value (ruby.string "") ruby.nil)) @@ -29,7 +29,7 @@ [(ruby.string //.variant-value-field) value]))) (def: #export (variant tag last? value) - (-> Nat Bool Expression Expression) + (-> Nat Bit Expression Expression) (variant' (%i (.int tag)) (flag last?) value)) (def: #export none diff --git a/new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux index 5bf7c9e8b..2a1f81d37 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux @@ -25,7 +25,7 @@ (wrap (ruby.array elemsT+))))) (def: #export (translate-variant translate tag tail? valueS) - (-> (-> Synthesis (Meta Expression)) Nat Bool Synthesis (Meta Expression)) + (-> (-> Synthesis (Meta Expression)) Nat Bit Synthesis (Meta Expression)) (do macro.Monad [valueT (translate valueS)] (wrap (runtimeT.variant tag tail? valueT)))) diff --git a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux index cbdd43d94..ae4a4151a 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux @@ -73,7 +73,7 @@ (#e.Success output))))) (def: (variant tag flag value) - (-> Nat Bool Any Any) + (-> Nat Bit Any Any) [(Long::intValue [] (:coerce Long tag)) (: Any (if flag diff --git a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux b/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux index 02574a31a..1e6cafdfc 100644 --- a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux +++ b/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux @@ -35,7 +35,7 @@ (do-template [ ] [(def: ( procedure params output-type) - (-> Text (List Code) Type Bool) + (-> Text (List Code) Type Bit) (|> (do Monad [## runtime-bytecode @runtime.translate ] @@ -56,7 +56,7 @@ (do-template [ ] [(def: ( syntax output-type) - (-> Code Type Bool) + (-> Code Type Bit) (|> (do Monad [## runtime-bytecode @runtime.translate ] @@ -365,7 +365,7 @@ (test "jvm object null?" (success "jvm object null?" (list boxedC) - Bool)) + Bit)) (test "jvm object synchronized" (success "jvm object synchronized" (list boxedC boxedC) @@ -388,18 +388,18 @@ (success "jvm object instance?" (list (code.text boxed) boxedC) - Bool)) + Bit)) (test "jvm object instance? (lineage)" (success "jvm object instance?" (list (' "java.lang.Object") boxedC) - Bool)) + Bit)) (test "jvm object instance? (no lineage)" (or (text/= "java.lang.Object" boxed) (failure "jvm object instance?" (list (code.text boxed) !boxedC) - Bool))) + Bit))) )))) (context: "Member [Static Field]." diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux index a026f8df2..b2d819ec5 100644 --- a/new-luxc/test/test/luxc/lang/analysis/type.lux +++ b/new-luxc/test/test/luxc/lang/analysis/type.lux @@ -3,7 +3,7 @@ (lux [io] (control [monad #+ do] pipe) - (data [bool "bool/" Eq] + (data [bit "bit/" Eq] [text "text/" Eq] (text format ["l" lexer]) @@ -36,7 +36,7 @@ ( value)]))] - [r.bool (+0 "#Bool" (+0)) code.bool] + [r.bit (+0 "#Bit" (+0)) code.bit] [r.nat (+0 "#Nat" (+0)) code.nat] [r.int (+0 "#Int" (+0)) code.int] [r.rev (+0 "#Rev" (+0)) code.rev] @@ -65,7 +65,7 @@ (^template [ ] [[_ ( expected)] [_ ( actual)]] ( expected actual)) - ([#.Bool bool/=] + ([#.Bit bit/=] [#.Nat n/=] [#.Int i/=] [#.Rev r/=] diff --git a/new-luxc/test/test/luxc/lang/synthesis/loop.lux b/new-luxc/test/test/luxc/lang/synthesis/loop.lux index 23641780f..af818255b 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/loop.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/loop.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [monad #+ do]) - (data [bool "bool/" Eq] + (data [bit "bit/" Eq] [number] (coll [list "list/" Functor Fold] (set ["set" unordered])) @@ -18,7 +18,7 @@ (// common)) (def: (does-recursion? arity exprS) - (-> ls.Arity ls.Synthesis Bool) + (-> ls.Arity ls.Synthesis Bit) (loop [exprS exprS] (case exprS (^ [_ (#.Form (list [_ (#.Text "lux case")] inputS pathS))]) @@ -68,19 +68,19 @@ (wrap (` ("lux case" (~ inputA) (~ (code.record (list.zip2 tests bodies)))))))) (r.either (do r.Monad - [valueS r.bool + [valueS r.bit output' (gen-body (n/inc arity) output)] - (wrap (` ("lux case" (~ (code.bool valueS)) + (wrap (` ("lux case" (~ (code.bit valueS)) {("lux case bind" (~ (code.nat arity))) (~ output')})))) (do r.Monad - [valueS r.bool - then|else r.bool + [valueS r.bit + then|else r.bit output' (gen-body arity output) #let [thenA (if then|else output' (' [])) elseA (if (not then|else) output' (' []))]] - (wrap (` ("lux case" (~ (code.bool valueS)) - {(~ (code.bool then|else)) (~ thenA) - (~ (code.bool (not then|else))) (~ elseA)}))))) + (wrap (` ("lux case" (~ (code.bit valueS)) + {(~ (code.bit then|else)) (~ thenA) + (~ (code.bit (not then|else))) (~ elseA)}))))) )) (def: (make-function arity body) @@ -90,14 +90,14 @@ _ (` ("lux function" [] (~ (make-function (n/dec arity) body)))))) (def: gen-recursion - (r.Random [Bool Nat la.Analysis]) + (r.Random [Bit Nat la.Analysis]) (do r.Monad [arity (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1)))) - recur? r.bool + recur? r.bit outputS (if recur? (wrap (la.apply (list.repeat arity (' [])) (la.var 0))) (do @ - [plus-or-minus? r.bool + [plus-or-minus? r.bit how-much (|> r.nat (:: @ map (|>> (n/% arity) (n/max +1)))) #let [shift (if plus-or-minus? n/+ n/-)]] (wrap (la.apply (list.repeat (shift how-much arity) (' [])) (la.var 0))))) @@ -105,17 +105,17 @@ (wrap [recur? arity (make-function arity bodyS)]))) (def: gen-loop - (r.Random [Bool Nat la.Analysis]) + (r.Random [Bit Nat la.Analysis]) (do r.Monad [arity (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1)))) - recur? r.bool - self-ref? r.bool + recur? r.bit + self-ref? r.bit #let [selfA (la.var 0) argA (if self-ref? selfA (' []))] outputS (if recur? (wrap (la.apply (list.repeat arity argA) selfA)) (do @ - [plus-or-minus? r.bool + [plus-or-minus? r.bit how-much (|> r.nat (:: @ map (|>> (n/% arity) (n/max +1)))) #let [shift (if plus-or-minus? n/+ n/-)]] (wrap (la.apply (list.repeat (shift how-much arity) (' [])) selfA)))) @@ -135,7 +135,7 @@ (^ [_ (#.Form (list [_ (#.Text "lux function")] [_ (#.Nat _arity)] [_ (#.Tuple _env)] _body))]) (|> _body (does-recursion? arity) - (bool/= prediction) + (bit/= prediction) (and (n/= arity _arity))) _ diff --git a/new-luxc/test/test/luxc/lang/translation/case.lux b/new-luxc/test/test/luxc/lang/translation/case.lux index a16715729..20d072651 100644 --- a/new-luxc/test/test/luxc/lang/translation/case.lux +++ b/new-luxc/test/test/luxc/lang/translation/case.lux @@ -14,7 +14,7 @@ (def: struct-limit Nat +10) (def: (tail? size idx) - (-> Nat Nat Bool) + (-> Nat Nat Bit) (n/= (n/dec size) idx)) (def: gen-case @@ -31,7 +31,7 @@ (wrap [( value) ( value)]))] - [r.bool //synthesis.bool //synthesis.path/bool] + [r.bit //synthesis.bit //synthesis.path/bit] [r.int //synthesis.i64 //synthesis.path/i64] [r.frac //synthesis.f64 //synthesis.path/f64] [(r.unicode +5) //synthesis.text //synthesis.path/text])) @@ -51,7 +51,7 @@ [size (|> r.nat (:: @ map (|>> (n/% struct-limit) (n/max +2)))) idx (|> r.nat (:: @ map (n/% size))) [subS subP] gen-case - #let [caseS (` ((~ (code.nat idx)) (~ (code.bool (tail? size idx))) (~ subS))) + #let [caseS (` ((~ (code.nat idx)) (~ (code.bit (tail? size idx))) (~ subS))) caseP (` ("lux case seq" (~ (if (tail? size idx) (` ("lux case variant right" (~ (code.nat idx)))) @@ -74,7 +74,7 @@ ("lux case seq" ("lux case bind" +0) ("lux case exec" false)))))) (case> (#e.Success valueT) - (:coerce Bool valueT) + (:coerce Bit valueT) (#e.Error error) (exec (log! error) diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux index 0e2d66503..9aba56d6b 100644 --- a/new-luxc/test/test/luxc/lang/translation/common.lux +++ b/new-luxc/test/test/luxc/lang/translation/common.lux @@ -6,7 +6,7 @@ (data text/format [bit] ["e" error] - [bool "bool/" Eq] + [bit "bit/" Eq] [text "text/" Eq] [number "int/" Number "frac/" Number Interval] (coll ["a" array] @@ -100,8 +100,8 @@ ["lux int *" i/* Int i/=] ["lux int /" i// Int i/=] ["lux int %" i/% Int i/=] - ["lux int =" i/= Bool bool/=] - ["lux int <" i/< Bool bool/=] + ["lux int =" i/= Bit bit/=] + ["lux int <" i/< Bit bit/=] )) )))) @@ -124,8 +124,8 @@ ["lux frac *" f/* Frac f/=] ["lux frac /" f// Frac f/=] ["lux frac %" f/% Frac f/=] - ["lux frac =" f/= Bool bool/=] - ["lux frac <" f/< Bool bool/=] + ["lux frac =" f/= Bit bit/=] + ["lux frac <" f/< Bit bit/=] )] ($_ seq @@ -202,20 +202,20 @@ (test "Can compare texts for equality." (and (|> (run (` ("lux text =" (~ sample0S) (~ sample0S)))) (case> (#e.Success valueV) - (:coerce Bool valueV) + (:coerce Bit valueV) _ false)) (|> (run (` ("lux text =" (~ sample0S) (~ sample1S)))) (case> (#e.Success valueV) - (not (:coerce Bool valueV)) + (not (:coerce Bit valueV)) _ false)))) (test "Can compare texts for order." (|> (run (` ("lux text <" (~ sample1S) (~ sample0S)))) (case> (#e.Success valueV) - (:coerce Bool valueV) + (:coerce Bit valueV) _ false))) @@ -423,7 +423,7 @@ [("lux atom compare-and-swap" (1) (0) (~ postS)) ("lux atom read" (1))])))) (case> (#e.Success valueV) - (let [[swapped? current-value] (:coerce [Bool Nat] valueV)] + (let [[swapped? current-value] (:coerce [Bit Nat] valueV)] (and swapped? (n/= post current-value))) @@ -435,7 +435,7 @@ [("lux atom compare-and-swap" (1) (~ postS) (~ postS)) ("lux atom read" (1))])))) (case> (#e.Success valueV) - (let [[swapped? current-value] (:coerce [Bool Nat] valueV)] + (let [[swapped? current-value] (:coerce [Bit Nat] valueV)] (and (not swapped?) (n/= pre current-value))) diff --git a/new-luxc/test/test/luxc/lang/translation/js.lux b/new-luxc/test/test/luxc/lang/translation/js.lux index 6f4fb572d..42947b580 100644 --- a/new-luxc/test/test/luxc/lang/translation/js.lux +++ b/new-luxc/test/test/luxc/lang/translation/js.lux @@ -20,15 +20,15 @@ (|> r.nat (:: r.Functor map (|>> (n/% +91) (n/max +65))))) (def: (test-primitive-identity synthesis) - (-> Synthesis Bool) + (-> Synthesis Bit) (|> (run-js (` ("lux is" (~ synthesis) (~ synthesis)))) (case> (#e.Success valueV) - (:coerce Bool valueV) + (:coerce Bit valueV) _ false))) -(type: Check (-> (e.Error Any) Bool)) +(type: Check (-> (e.Error Any) Bit)) (do-template [
 <=>]
   [(def: ( angle)
diff --git a/new-luxc/test/test/luxc/lang/translation/jvm.lux b/new-luxc/test/test/luxc/lang/translation/jvm.lux
index 6652c8484..34f1af508 100644
--- a/new-luxc/test/test/luxc/lang/translation/jvm.lux
+++ b/new-luxc/test/test/luxc/lang/translation/jvm.lux
@@ -6,7 +6,7 @@
        (data [maybe]
              ["e" error]
              [bit]
-             [bool "bool/" Eq]
+             [bit "bit/" Eq]
              [number "int/" Number Codec]
              [text "text/" Eq]
              text/format
@@ -242,8 +242,8 @@
                                                   (lang.with-current-module "")
                                                   (macro.run (io.run init-jvm))
                                                   (case> (#e.Success valueT)
-                                                         (bool/= ( param subject)
-                                                                 (:coerce Bool valueT))
+                                                         (bit/= ( param subject)
+                                                                (:coerce Bit valueT))
 
                                                          (#e.Error error)
                                                          false)))]
@@ -279,7 +279,7 @@
       (do @
         [size (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
          idx (|> r.nat (:: @ map (n/% size)))
-         valueZ r.bool
+         valueZ r.bit
          valueB gen-int
          valueS gen-int
          valueI gen-int
@@ -303,7 +303,7 @@
                                                       (#e.Error error)
                                                       false)))]
 
-                                    ["boolean" Bool valueZ bool/= (code.bool valueZ)
+                                    ["boolean" Bit valueZ bit/= (code.bit valueZ)
                                      id]
                                     ["byte" Int valueB i/= (|> (code.int valueB) (~) "jvm convert long-to-byte" (`))
                                      "jvm convert byte-to-long"]
@@ -327,7 +327,7 @@
       (do @
         [size (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
          idx (|> r.nat (:: @ map (n/% size)))
-         valueZ r.bool
+         valueZ r.bit
          valueB gen-int
          valueS gen-int
          valueI gen-int
@@ -401,7 +401,7 @@
 
 (def: instances
   (List [Text (r.Random ls.Synthesis)])
-  (let [gen-boolean (|> r.bool (:: r.Functor map code.bool))
+  (let [gen-boolean (|> r.bit (:: r.Functor map code.bit))
         gen-integer (|> r.int (:: r.Functor map code.int))
         gen-double (|> r.frac (:: r.Functor map code.frac))
         gen-string (|> (r.text +5) (:: r.Functor map code.text))]
@@ -436,7 +436,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (:coerce Bool outputT)
+                             (:coerce Bit outputT)
 
                              (#e.Error error)
                              false)))
@@ -447,7 +447,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (not (:coerce Bool outputT))
+                             (not (:coerce Bit outputT))
 
                              (#e.Error error)
                              false)))
@@ -500,7 +500,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (:coerce Bool outputT)
+                             (:coerce Bit outputT)
 
                              (#e.Error error)
                              false)))
@@ -610,7 +610,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (:coerce Bool outputT)
+                             (:coerce Bit outputT)
 
                              (#e.Error error)
                              false)))
@@ -623,7 +623,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (:coerce Bool outputT)
+                             (:coerce Bit outputT)
 
                              (#e.Error error)
                              false)))
diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux
index 43886e197..a58b3b97e 100644
--- a/new-luxc/test/test/luxc/lang/translation/primitive.lux
+++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux
@@ -5,7 +5,7 @@
                 pipe)
        (data text/format
              ["e" error]
-             [bool "bool/" Eq]
+             [bit "bit/" Eq]
              [text "text/" Eq])
        ["r" math/random]
        (lang ["//." synthesis])
@@ -16,7 +16,7 @@
 (def: (spec run)
   (-> Runner Test)
   (do r.Monad
-    [%bool% r.bool
+    [%bit% r.bit
      %nat% r.nat
      %int% r.int
      %rev% r.rev
@@ -33,7 +33,7 @@
                                     (exec (log! error)
                                       false))))]
 
-                  ["bool" Bool //synthesis.bool %bool% bool/=]
+                  ["bit" Bit //synthesis.bit %bit% bit/=]
                   ["int"  Int  //synthesis.i64  %int%  i/=]
                   ["frac" Frac //synthesis.f64  %frac% f/=]
                   ["text" Text //synthesis.text %text% text/=]))
diff --git a/new-luxc/test/test/luxc/lang/translation/structure.lux b/new-luxc/test/test/luxc/lang/translation/structure.lux
index df1350395..17068bb72 100644
--- a/new-luxc/test/test/luxc/lang/translation/structure.lux
+++ b/new-luxc/test/test/luxc/lang/translation/structure.lux
@@ -5,7 +5,7 @@
                 pipe)
        (data ["e" error]
              [maybe]
-             [bool "bool/" Eq]
+             [bit "bit/" Eq]
              [text "text/" Eq]
              text/format
              (coll [array]
@@ -48,7 +48,7 @@
      #let [last?-in (n/= (n/dec num-tags) tag-in)]
      value-in r.int]
     (test "Can translate variant."
-          (|> (run (` ((~ (code.nat tag-in)) (~ (code.bool last?-in)) (~ (code.int value-in)))))
+          (|> (run (` ((~ (code.nat tag-in)) (~ (code.bit last?-in)) (~ (code.int value-in)))))
               (case> (#e.Success valueT)
                      (let [valueT (:coerce (Array Any) valueT)]
                        (and (n/= +3 (array.size valueT))
-- 
cgit v1.2.3