From bf53ee92fc3c33a4885aa227e55d24f7ba3cb2c4 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 16 Mar 2022 08:37:23 -0400 Subject: De-sigil-ification: prefix : --- lux-jvm/source/luxc/lang/directive/jvm.lux | 28 ++--- lux-jvm/source/luxc/lang/translation/jvm.lux | 56 +++++----- lux-jvm/source/luxc/lang/translation/jvm/case.lux | 32 +++--- .../luxc/lang/translation/jvm/extension/common.lux | 118 ++++++++++----------- .../luxc/lang/translation/jvm/extension/host.lux | 28 ++--- .../source/luxc/lang/translation/jvm/function.lux | 42 ++++---- lux-jvm/source/luxc/lang/translation/jvm/loop.lux | 16 +-- .../source/luxc/lang/translation/jvm/primitive.lux | 2 +- .../source/luxc/lang/translation/jvm/runtime.lux | 32 +++--- 9 files changed, 177 insertions(+), 177 deletions(-) (limited to 'lux-jvm') diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index f125192f5..ff0e5cecf 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -559,7 +559,7 @@ (-> jvm.Extender Any jvm.Handler) (function (_ extension_name phase archive inputs) (# phase.monad each - (|>> (:as (/.Bytecode Inst /.Label)) ..bytecode) + (|>> (as (/.Bytecode Inst /.Label)) ..bytecode) ((extender pseudo) extension_name phase archive inputs)))) (type: Phase (directive.Phase jvm.Anchor jvm.Inst jvm.Definition)) @@ -573,13 +573,13 @@ (pattern (list nameC valueC)) (do phase.monad [[_ _ name] (lux/.evaluate! archive Text nameC) - [_ handlerV] (lux/.generator archive (:as Text name) ..Handler' valueC) + [_ handlerV] (lux/.generator archive (as Text name) ..Handler' valueC) _ (|> handlerV (..true_handler extender) - (extension.install extender (:as Text name)) + (extension.install extender (as Text name)) directive.lifted_generation) _ (directive.lifted_generation - (generation.log! (format "Generation " (%.text (:as Text name)))))] + (generation.log! (format "Generation " (%.text (as Text name)))))] (in directive.no_requirements)) _ @@ -758,10 +758,10 @@ (def: constructor (Parser (Constructor Code)) - (let [constructor_argument (: (Parser [(Type Value) Code]) - (.tuple - (<>.and ..value - .any)))] + (let [constructor_argument (is (Parser [(Type Value) Code]) + (.tuple + (<>.and ..value + .any)))] (<| .form (<>.after (.text! "init")) ($_ <>.and @@ -1311,10 +1311,10 @@ /type.void (list)]) argumentsT (list#each product.right arguments) - initialize_object! (: Inst - (|>> (_.ALOAD 0) - super_constructor_argument_values - (_.INVOKESPECIAL super_class ..constructor_name super_constructorT)))]] + initialize_object! (is Inst + (|>> (_.ALOAD 0) + super_constructor_argument_values + (_.INVOKESPECIAL super_class ..constructor_name super_constructorT)))]] (in (def.method (..visibility privacy) (if strict_floating_point? jvm.strictM @@ -1459,8 +1459,8 @@ ... Necessary for reflection to work properly during analysis. _ (directive.lifted_generation (generation.execute! header)) - .let [supers (: (List (Type Class)) - (list& super_class super_interfaces))] + .let [supers (is (List (Type Class)) + (list& super_class super_interfaces))] _ (|> methodsC (list.all ..convert_overriden_method) (//A.require_complete_method_concretion class_loader supers) diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index 99ff673b6..b9ec15962 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -141,7 +141,7 @@ (# io.monad each (function (_ library) (dictionary.key? library class_name))) (try.lifted io.monad) - (: (IO (Try Bit)))) + (is (IO (Try Bit)))) _ (if existing_class? (in []) (loader.store class_name class_bytecode library))] @@ -160,33 +160,33 @@ (io (let [library (loader.new_library []) loader (loader.memory library)] [loader - (: Host - (implementation - (def: (evaluate context valueI) - (# try.monad each product.left - (..evaluate! library loader (format "E" (..class_name context)) valueI))) - - (def: execute - (..execute! library loader)) - - (def: define - (..define! library loader)) - - (def: (ingest context bytecode) - [(..class_name context) bytecode]) - - (def: (re_learn context custom [_ bytecode]) - (io.run! - (loader.store (maybe.else (..class_name context) custom) bytecode library))) - - (def: (re_load context custom [directive_name bytecode]) - (io.run! - (do (try.with io.monad) - [.let [class_name (maybe.else (..class_name context) - custom)] - _ (loader.store class_name bytecode library) - class (loader.load class_name loader)] - (# io.monad in (..class_value class_name class)))))))]))) + (is Host + (implementation + (def: (evaluate context valueI) + (# try.monad each product.left + (..evaluate! library loader (format "E" (..class_name context)) valueI))) + + (def: execute + (..execute! library loader)) + + (def: define + (..define! library loader)) + + (def: (ingest context bytecode) + [(..class_name context) bytecode]) + + (def: (re_learn context custom [_ bytecode]) + (io.run! + (loader.store (maybe.else (..class_name context) custom) bytecode library))) + + (def: (re_load context custom [directive_name bytecode]) + (io.run! + (do (try.with io.monad) + [.let [class_name (maybe.else (..class_name context) + custom)] + _ (loader.store class_name bytecode library) + class (loader.load class_name loader)] + (# io.monad in (..class_value class_name class)))))))]))) (def: .public $Variant (type.array ..$Value)) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index 8e90b4510..cb5004f83 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -133,22 +133,22 @@ (^.template [ ] [{ cons} (do [@ phase.monad] - [forkG (: (Operation Inst) - (monad.mix @ (function (_ [test thenP] elseG) - (do @ - [thenG (path' stack_depth @else @end phase archive thenP)] - (in (<| _.with_label (function (_ @else)) - (|>> - ( test) - - ( @else) - - thenG - (_.label @else) - elseG))))) - (|>> - (_.GOTO @else)) - {.#Item cons}))] + [forkG (is (Operation Inst) + (monad.mix @ (function (_ [test thenP] elseG) + (do @ + [thenG (path' stack_depth @else @end phase archive thenP)] + (in (<| _.with_label (function (_ @else)) + (|>> + ( test) + + ( @else) + + thenG + (_.label @else) + elseG))))) + (|>> + (_.GOTO @else)) + {.#Item cons}))] (in (|>> peekI forkG)))]) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux index 20f3fdf7a..10fe4e948 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux @@ -1,45 +1,45 @@ (.using - [library - [lux {"-" Type Label} - [ffi {"+" import:}] - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" try] - ["<>" parser - ["" synthesis {"+" Parser}]]] - [data - ["[0]" product] - [collection - ["[0]" list ("[1]@[0]" monad)] - ["[0]" dictionary]]] - [math - [number - ["f" frac]]] - [target - [jvm - ["[0]" type]]] - [tool - [compiler - ["[0]" phase] - [meta - [archive {"+" Archive}]] - [language - [lux - ["[0]" synthesis {"+" Synthesis %synthesis}] - [phase - [generation - [extension {"+" Nullary Unary Binary Trinary Variadic - nullary unary binary trinary variadic}]] - ["[0]" extension - ["[0]" bundle]]]]]]]]] - [luxc - [lang - [host - ["$" jvm {"+" Label Inst Def Handler Bundle Operation Phase} - ["_" inst]]]]] - ["[0]" /// - ["[0]" runtime]]) + [library + [lux {"-" Type Label} + [ffi {"+" import:}] + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" try] + ["<>" parser + ["" synthesis {"+" Parser}]]] + [data + ["[0]" product] + [collection + ["[0]" list ("[1]@[0]" monad)] + ["[0]" dictionary]]] + [math + [number + ["f" frac]]] + [target + [jvm + ["[0]" type]]] + [tool + [compiler + ["[0]" phase] + [meta + [archive {"+" Archive}]] + [language + [lux + ["[0]" synthesis {"+" Synthesis %synthesis}] + [phase + [generation + [extension {"+" Nullary Unary Binary Trinary Variadic + nullary unary binary trinary variadic}]] + ["[0]" extension + ["[0]" bundle]]]]]]]]] + [luxc + [lang + [host + ["$" jvm {"+" Label Inst Def Handler Bundle Operation Phase} + ["_" inst]]]]] + ["[0]" /// + ["[0]" runtime]]) (def: .public (custom [parser handler]) (All (_ s) @@ -93,19 +93,19 @@ (do [@ phase.monad] [inputG (phase archive input) elseG (phase archive else) - conditionalsG+ (: (Operation (List [(List [Int Label]) - Inst])) - (monad.each @ (function (_ [chars branch]) - (do @ - [branchG (phase archive branch)] - (in (<| _.with_label (function (_ @branch)) - [(list@each (function (_ char) - [(.int char) @branch]) - chars) - (|>> (_.label @branch) - branchG - (_.GOTO @end))])))) - conditionals)) + conditionalsG+ (is (Operation (List [(List [Int Label]) + Inst])) + (monad.each @ (function (_ [chars branch]) + (do @ + [branchG (phase archive branch)] + (in (<| _.with_label (function (_ @branch)) + [(list@each (function (_ char) + [(.int char) @branch]) + chars) + (|>> (_.label @branch) + branchG + (_.GOTO @end))])))) + conditionals)) .let [table (|> conditionalsG+ (list@each product.left) list@conjoint) @@ -291,7 +291,7 @@ (def: bundle::lux Bundle - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "syntax char case!" lux::syntax_char_case!) (bundle.install "is" (binary lux::is)) (bundle.install "try" (unary lux::try)))) @@ -299,7 +299,7 @@ (def: bundle::i64 Bundle (<| (bundle.prefix "i64") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "and" (binary i64::and)) (bundle.install "or" (binary i64::or)) (bundle.install "xor" (binary i64::xor)) @@ -318,7 +318,7 @@ (def: bundle::f64 Bundle (<| (bundle.prefix "f64") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary f64::+)) (bundle.install "-" (binary f64::-)) (bundle.install "*" (binary f64::*)) @@ -333,7 +333,7 @@ (def: bundle::text Bundle (<| (bundle.prefix "text") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "=" (binary text::=)) (bundle.install "<" (binary text::<)) (bundle.install "concat" (binary text::concat)) @@ -345,7 +345,7 @@ (def: bundle::io Bundle (<| (bundle.prefix "io") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "log" (unary io::log)) (bundle.install "error" (unary io::error))))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux index f98188196..820e230db 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -164,7 +164,7 @@ (def: conversion_bundle Bundle (<| (bundle.prefix "conversion") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "double-to-float" (unary conversion::double_to_float)) (bundle.install "double-to-int" (unary conversion::double_to_int)) (bundle.install "double-to-long" (unary conversion::double_to_long)) @@ -295,7 +295,7 @@ (def: int_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.int)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary int::+)) (bundle.install "-" (binary int::-)) (bundle.install "*" (binary int::*)) @@ -314,7 +314,7 @@ (def: long_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.long)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary long::+)) (bundle.install "-" (binary long::-)) (bundle.install "*" (binary long::*)) @@ -333,7 +333,7 @@ (def: float_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.float)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary float::+)) (bundle.install "-" (binary float::-)) (bundle.install "*" (binary float::*)) @@ -346,7 +346,7 @@ (def: double_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.double)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary double::+)) (bundle.install "-" (binary double::-)) (bundle.install "*" (binary double::*)) @@ -359,7 +359,7 @@ (def: char_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.char)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "=" (binary char::=)) (bundle.install "<" (binary char::<)) ))) @@ -615,7 +615,7 @@ (def: object_bundle Bundle (<| (bundle.prefix "object") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "null" (nullary object::null)) (bundle.install "null?" (unary object::null?)) (bundle.install "synchronized" (binary object::synchronized)) @@ -794,17 +794,17 @@ (def: member_bundle Bundle (<| (bundle.prefix "member") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (dictionary.merged (<| (bundle.prefix "get") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "static" get::static) (bundle.install "virtual" get::virtual)))) (dictionary.merged (<| (bundle.prefix "put") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "static" put::static) (bundle.install "virtual" put::virtual)))) (dictionary.merged (<| (bundle.prefix "invoke") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "static" invoke::static) (bundle.install "virtual" invoke::virtual) (bundle.install "special" invoke::special) @@ -834,7 +834,7 @@ hidden [_ {synthesis.#Control {synthesis.#Branch {synthesis.#Case _ path}}}] - (loop [path (: synthesis.Path path)] + (loop [path (is synthesis.Path path)] (case path (^.or {synthesis.#Pop} {synthesis.#Access _} @@ -1088,7 +1088,7 @@ (list#mix (function (_ [lux_register type] [jvm_register before]) (let [[jvm_register' after] (prepare_argument (n.+ offset lux_register) type jvm_register)] [jvm_register' (|>> before after)])) - (: [Register Inst] [offset (|>>)])) + (is [Register Inst] [offset (|>>)])) product.right)) (def: .public (returnI returnT) @@ -1228,7 +1228,7 @@ (def: class_bundle Bundle (<| (bundle.prefix "class") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "anonymous" class::anonymous) ))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index 92ca0e16c..f93f4d035 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -173,8 +173,8 @@ (def: (with_init class env arity) (-> (Type Class) (Environment Synthesis) Arity Def) (let [env_size (list.size env) - offset_partial (: (-> Nat Nat) - (|>> ++ (n.+ env_size))) + offset_partial (is (-> Nat Nat) + (|>> ++ (n.+ env_size))) store_capturedI (|> (case env_size 0 (list) _ (enum.range n.enum 0 (-- env_size))) @@ -283,25 +283,25 @@ (-> Phase Archive Label Text (Environment Synthesis) Arity Inst (Operation [Def Inst])) (let [classD (type.class class (list)) - applyD (: Def - (if (poly_arg? arity) - (|> (n.min arity //runtime.num_apply_variants) - (enum.range n.enum 1) - (list@each (with_apply classD env arity @begin bodyI)) - (list& (with_implementation arity @begin bodyI)) - def.fuse) - (def.method {$.#Public} $.strictM //runtime.apply_method (//runtime.apply_signature 1) - (|>> (_.label @begin) - bodyI - _.ARETURN)))) - functionD (: Def - (|>> (def.int_field {$.#Public} ($_ $.++F $.staticF $.finalF) arity_field (.int arity)) - (with_environment env) - (with_partial arity) - (with_init classD env arity) - (with_reset classD arity env) - applyD - ))] + applyD (is Def + (if (poly_arg? arity) + (|> (n.min arity //runtime.num_apply_variants) + (enum.range n.enum 1) + (list@each (with_apply classD env arity @begin bodyI)) + (list& (with_implementation arity @begin bodyI)) + def.fuse) + (def.method {$.#Public} $.strictM //runtime.apply_method (//runtime.apply_signature 1) + (|>> (_.label @begin) + bodyI + _.ARETURN)))) + functionD (is Def + (|>> (def.int_field {$.#Public} ($_ $.++F $.staticF $.finalF) arity_field (.int arity)) + (with_environment env) + (with_partial arity) + (with_init classD env arity) + (with_reset classD arity env) + applyD + ))] (do phase.monad [instanceI (..instance generate archive classD arity env)] (in [functionD instanceI])))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux index 92b8c0286..4449b3606 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux @@ -53,16 +53,16 @@ ... will refer to the new value of X, instead of the old value, and ... shouldn't be the case. valuesI+ (monad.each @ (function (_ [register argS]) - (: (Operation Inst) - (if (invariant? register argS) - (in function.identity) - (translate archive argS)))) + (is (Operation Inst) + (if (invariant? register argS) + (in function.identity) + (translate archive argS)))) pairs) .let [storesI+ (list@each (function (_ [register argS]) - (: Inst - (if (invariant? register argS) - function.identity - (_.ASTORE register)))) + (is Inst + (if (invariant? register argS) + function.identity + (_.ASTORE register)))) (list.reversed pairs))]] (in (|>> (_.fuse valuesI+) (_.fuse storesI+) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux index 49bc10ff3..734b55316 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux @@ -102,7 +102,7 @@ _ (let [constantI (if (|> value - (:as java/lang/Double) + (as java/lang/Double) java/lang/Double::doubleToRawLongBits (i.= ..d0-bits)) _.DCONST_0 diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux index ee3e16ed8..76c170725 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux @@ -167,11 +167,11 @@ last_rightI _.AALOAD (_.CHECKCAST //.$Tuple)) - recurI (: (-> Label Inst) - (function (_ @loop) - (|>> sub_leftsI (_.ISTORE 1) - sub_tupleI (_.ASTORE 0) - (_.GOTO @loop))))] + recurI (is (-> Label Inst) + (function (_ @loop) + (|>> sub_leftsI (_.ISTORE 1) + sub_tupleI (_.ASTORE 0) + (_.GOTO @loop))))] (|>> ($d.method {$.#Public} $.staticM "pm_fail" throw_methodT (|>> (illegal_state_exception "Invalid expression for pattern-matching.") _.ATHROW)) @@ -200,12 +200,12 @@ $lefts (_.ILOAD 1) $right? (_.ALOAD 2) - variant_partI (: (-> Nat Inst) - (function (_ idx) - (|>> (_.int (.int idx)) _.AALOAD))) - ::lefts (: Inst - (|>> (variant_partI 0) - (_.unwrap type.int))) + variant_partI (is (-> Nat Inst) + (function (_ idx) + (|>> (_.int (.int idx)) _.AALOAD))) + ::lefts (is Inst + (|>> (variant_partI 0) + (_.unwrap type.int))) ::right? (variant_partI 1) ::value (variant_partI 2) @@ -226,11 +226,11 @@ update_$lefts (|>> _.ISUB (_.int +1) _.ISUB) - iterate! (: (-> Label Inst) - (function (_ @loop) - (|>> update_$variant - update_$lefts - (_.GOTO @loop))))]) + iterate! (is (-> Label Inst) + (function (_ @loop) + (|>> update_$variant + update_$lefts + (_.GOTO @loop))))]) (|>> $lefts ... lefts (_.label @loop) $variant ::lefts ... lefts, variant::lefts -- cgit v1.2.3