diff options
author | Eduardo Julian | 2021-08-08 17:56:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-08 17:56:15 -0400 |
commit | f621a133e6e0a516c0586270fea8eaffb4829d82 (patch) | |
tree | 399396ee2f6a10df10cea9b78c51c76679b70e59 /lux-jvm/source/luxc/lang/translation/jvm | |
parent | 17e7566be51df5e428a6b10e6469201a8a9468da (diff) |
No more #export magic syntax.
Diffstat (limited to '')
14 files changed, 88 insertions, 88 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index 4cf712a45..46242abc7 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -57,23 +57,23 @@ (import: java/lang/ClassLoader) -(type: #export ByteCode Binary) +(type: .public ByteCode Binary) -(def: #export value_field Text "_value") -(def: #export $Value (type.class "java.lang.Object" (list))) +(def: .public value_field Text "_value") +(def: .public $Value (type.class "java.lang.Object" (list))) -(exception: #export (cannot_load {class Text} {error Text}) +(exception: .public (cannot_load {class Text} {error Text}) (exception.report ["Class" class] ["Error" error])) -(exception: #export (invalid_field {class Text} {field Text} {error Text}) +(exception: .public (invalid_field {class Text} {field Text} {error Text}) (exception.report ["Class" class] ["Field" field] ["Error" error])) -(exception: #export (invalid_value {class Text}) +(exception: .public (invalid_value {class Text}) (exception.report ["Class" class])) @@ -98,11 +98,11 @@ (def: class_path_separator ".") -(def: #export bytecode_name +(def: .public bytecode_name (-> Text Text) (text.replace_all ..class_path_separator .module_separator)) -(def: #export (class_name [module_id artifact_id]) +(def: .public (class_name [module_id artifact_id]) (-> generation.Context Text) (format lux_context ..class_path_separator (%.nat version.version) @@ -154,7 +154,7 @@ custom) value definition]))) -(def: #export host +(def: .public host (IO [java/lang/ClassLoader Host]) (io (let [library (loader.new_library []) loader (loader.memory library)] @@ -181,20 +181,20 @@ (def: (re_load context custom [directive_name bytecode]) (io.run (do (try.with io.monad) - [#let [class_name (maybe.else (..class_name context) + [.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: #export $Variant +(def: .public $Variant (type.array ..$Value)) -(def: #export $Tuple +(def: .public $Tuple (type.array ..$Value)) -(def: #export $Runtime +(def: .public $Runtime (type.class (..class_name [0 0]) (list))) -(def: #export $Function +(def: .public $Function (type.class (..class_name [0 1]) (list))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index 2c9bfdb61..a863f9113 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -119,7 +119,7 @@ #.None (in (_.GOTO @else))) - #let [ifI (.if when _.IFEQ _.IFNE)]] + .let [ifI (.if when _.IFEQ _.IFNE)]] (in (<| _.with_label (function (_ @else)) (|>> peekI (_.unwrap type.boolean) @@ -236,7 +236,7 @@ _.NULL (_.GOTO @end))))) -(def: #export (if phase archive [testS thenS elseS]) +(def: .public (if phase archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) (do phase.monad [testI (phase archive testS) @@ -253,7 +253,7 @@ elseI (_.label @end)))))) -(def: #export (let phase archive [inputS register exprS]) +(def: .public (let phase archive [inputS register exprS]) (Generator [Synthesis Nat Synthesis]) (do phase.monad [inputI (phase archive inputS) @@ -262,7 +262,7 @@ (_.ASTORE register) exprI)))) -(def: #export (get phase archive [path recordS]) +(def: .public (get phase archive [path recordS]) (Generator [(List synthesis.Member) Synthesis]) (do phase.monad [recordG (phase archive recordS)] @@ -277,7 +277,7 @@ recordG (list.reversed path))))) -(def: #export (case phase archive [valueS path]) +(def: .public (case phase archive [valueS path]) (Generator [Synthesis Path]) (do phase.monad [@end _.make_label diff --git a/lux-jvm/source/luxc/lang/translation/jvm/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/common.lux index 10e865283..65714f909 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/common.lux @@ -28,7 +28,7 @@ ## [type]]]]] ) -## (def: #export (with-artifacts action) +## (def: .public (with-artifacts action) ## (All [a] (-> (Meta a) (Meta [Artifacts a]))) ## (function (_ state) ## (case (action (update@ #.host @@ -48,7 +48,7 @@ ## (#try.Failure error) ## (#try.Failure error)))) -## (def: #export (load-definition state) +## (def: .public (load-definition state) ## (-> Lux (-> Name Binary (Try Any))) ## (function (_ (^@ def-name [def-module def-name]) def-bytecode) ## (let [normal-name (format (name.normalize def-name) (%n (text/hash def-name))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/expression.lux b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux index 44abe2444..41f795adc 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/expression.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux @@ -21,7 +21,7 @@ ["." loop] ["." function]]) -(def: #export (translate archive synthesis) +(def: .public (translate archive synthesis) Phase (case synthesis (^ (synthesis.bit value)) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension.lux index 8fced4749..69f29376c 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension.lux @@ -11,7 +11,7 @@ ["#." common] ["#." host]]) -(def: #export bundle +(def: .public bundle Bundle (dictionary.merged /common.bundle /host.bundle)) 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 eb3d02be7..8c6d96283 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux @@ -41,7 +41,7 @@ ["." /// ["." runtime]]) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [s] (-> [(Parser s) (-> Text Phase Archive s (Operation Inst))] @@ -111,7 +111,7 @@ branchG (_.GOTO @end))])))) conditionals)) - #let [table (|> conditionalsG+ + .let [table (|> conditionalsG+ (list@map product.left) list@join) conditionalsG (|> conditionalsG+ @@ -367,7 +367,7 @@ (bundle.install "log" (unary io::log)) (bundle.install "error" (unary io::error))))) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "lux") (|> bundle::lux 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 e87ea6510..069f23fae 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -68,7 +68,7 @@ ["#." function]]]) (template [<name> <category> <parser>] - [(def: #export <name> + [(def: .public <name> (Parser (Type <category>)) (<text>.then <parser> <synthesis>.text))] @@ -87,11 +87,11 @@ (All [a] (-> (Type a) Text)) (|>> type.descriptor descriptor.descriptor)) -(exception: #export (not_an_object_array {arrayJT (Type Array)}) +(exception: .public (not_an_object_array {arrayJT (Type Array)}) (exception.report ["JVM Type" (..signature arrayJT)])) -(def: #export object_array +(def: .public object_array (Parser (Type Object)) (do <>.monad [arrayJT (<text>.then parser.array <synthesis>.text)] @@ -642,7 +642,7 @@ (function (_ extension_name generate archive [class field unboxed valueS]) (do phase.monad [valueI (generate archive valueS) - #let [$class (type.class class (list))]] + .let [$class (type.class class (list))]] (case (dictionary.get unboxed ..primitives) (#.Some primitive) (in (|>> valueI @@ -662,7 +662,7 @@ (function (_ extension_name generate archive [class field unboxed objectS]) (do phase.monad [objectI (generate archive objectS) - #let [$class (type.class class (list)) + .let [$class (type.class class (list)) getI (case (dictionary.get unboxed ..primitives) (#.Some primitive) (_.GETFIELD $class field primitive) @@ -681,7 +681,7 @@ (do phase.monad [valueI (generate archive valueS) objectI (generate archive objectS) - #let [$class (type.class class (list)) + .let [$class (type.class class (list)) putI (case (dictionary.get unboxed ..primitives) (#.Some primitive) (_.PUTFIELD $class field primitive) @@ -808,7 +808,7 @@ (Parser Argument) (<synthesis>.tuple (<>.and <synthesis>.text ..value))) -(def: #export (hidden_method_body arity body) +(def: .public (hidden_method_body arity body) (-> Nat Synthesis Synthesis) (case [arity body] [0 _] body @@ -1027,7 +1027,7 @@ ## (\ type.equivalence = type.double argumentT) (wrap_primitive 2 _.DLOAD type.double)))))) -(def: #export (prepare_arguments offset types) +(def: .public (prepare_arguments offset types) (-> Nat (List (Type Value)) Inst) (|> types list.enumeration @@ -1037,7 +1037,7 @@ (: [Register Inst] [offset (|>>)])) product.right)) -(def: #export (returnI returnT) +(def: .public (returnI returnT) (-> (Type Return) Inst) (case (type.void? returnT) (#.Right returnT) @@ -1087,7 +1087,7 @@ overriden_methods]) (do {! phase.monad} [[context _] (generation.with_new_context archive (in [])) - #let [[module_id artifact_id] context + .let [[module_id artifact_id] context anonymous_class_name (///.class_name context) class (type.class anonymous_class_name (list)) total_environment (|> overriden_methods @@ -1097,7 +1097,7 @@ list\join ## Remove duplicates. (set.of_list synthesis.hash) - set.to_list) + set.list) global_mapping (|> total_environment ## Give them names as "foreign" variables. list.enumeration @@ -1131,7 +1131,7 @@ (do ! [bodyG (generation.with_context artifact_id (generate archive bodyS)) - #let [argumentsT (list\map product.right arguments)]] + .let [argumentsT (list\map product.right arguments)]] (in (_def.method #$.Public (if strict_fp? ($_ $.++M $.finalM $.strictM) @@ -1142,7 +1142,7 @@ bodyG (returnI returnT))))))) (\ ! map _def.fuse)) - #let [directive [anonymous_class_name + .let [directive [anonymous_class_name (_def.class #$.V1_6 #$.Public $.finalC anonymous_class_name (list) super_class super_interfaces @@ -1160,7 +1160,7 @@ (bundle.install "anonymous" class::anonymous) ))) -(def: #export bundle +(def: .public bundle Bundle (<| (bundle.prefix "jvm") (|> ..conversion_bundle diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index bb592ca32..ac2adaaaa 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -110,7 +110,7 @@ (-> Phase Archive (Type Class) Arity (Environment Synthesis) (Operation Inst)) (do {@ phase.monad} [captureI+ (monad.map @ (generate archive) env) - #let [argsI (if (poly_arg? arity) + .let [argsI (if (poly_arg? arity) (|> (nullsI (dec arity)) (list (_.int +0)) _.fuse) @@ -260,7 +260,7 @@ casesI )))) -(def: #export with_environment +(def: .public with_environment (-> (Environment Synthesis) Def) (|>> list.enumeration (list@map (.function (_ [env_idx env_source]) @@ -276,7 +276,7 @@ def.fuse) function.identity)) -(def: #export (with_function generate archive @begin class env arity bodyI) +(def: .public (with_function generate archive @begin class env arity bodyI) (-> Phase Archive Label Text (Environment Synthesis) Arity Inst (Operation [Def Inst])) (let [classD (type.class class (list)) @@ -303,7 +303,7 @@ [instanceI (..instance generate archive classD arity env)] (in [functionD instanceI])))) -(def: #export (function' forced_context generate archive [env arity bodyS]) +(def: .public (function' forced_context generate archive [env arity bodyS]) (-> (Maybe Context) (Generator Abstraction)) (do {! phase.monad} [@begin _.make_label @@ -319,9 +319,9 @@ (generation.with_new_context archive (generation.with_anchor [@begin 1] (generate archive bodyS)))) - #let [function_class (//.class_name function_context)] + .let [function_class (//.class_name function_context)] [functionD instanceI] (..with_function generate archive @begin function_class env arity bodyI) - #let [directive [function_class + .let [directive [function_class (def.class #$.V1_6 #$.Public $.finalC function_class (list) //.$Function (list) @@ -335,16 +335,16 @@ (in []))] (in instanceI))) -(def: #export function +(def: .public function (Generator Abstraction) (..function' #.None)) -(def: #export (call generate archive [functionS argsS]) +(def: .public (call generate archive [functionS argsS]) (Generator Apply) (do {@ phase.monad} [functionI (generate archive functionS) argsI (monad.map @ (generate archive) argsS) - #let [applyI (|> argsI + .let [applyI (|> argsI (list.chunk //runtime.num_apply_variants) (list@map (.function (_ chunkI+) (|>> (_.CHECKCAST //.$Function) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux index 40f8ef0de..bd1e29d0f 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux @@ -36,11 +36,11 @@ _ false)) -(def: #export (recur translate archive argsS) +(def: .public (recur translate archive argsS) (Generator (List Synthesis)) (do {@ phase.monad} [[@begin start] generation.anchor - #let [pairs (|> argsS + .let [pairs (|> argsS list.enumeration (list@map (function (_ [register argument]) [(n.+ start register) argument])))] @@ -58,7 +58,7 @@ (in function.identity) (translate archive argS)))) pairs) - #let [storesI+ (list@map (function (_ [register argS]) + .let [storesI+ (list@map (function (_ [register argS]) (: Inst (if (invariant? register argS) function.identity @@ -68,14 +68,14 @@ (_.fuse storesI+) (_.GOTO @begin))))) -(def: #export (scope translate archive [start initsS+ iterationS]) +(def: .public (scope translate archive [start initsS+ iterationS]) (Generator [Nat (List Synthesis) Synthesis]) (do {@ phase.monad} [@begin _.make_label initsI+ (monad.map @ (translate archive) initsS+) iterationI (generation.with_anchor [@begin start] (translate archive iterationS)) - #let [initializationI (|> (list.enumeration initsI+) + .let [initializationI (|> (list.enumeration initsI+) (list@map (function (_ [register initI]) (|>> initI (_.ASTORE (n.+ start register))))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux index 2c814d24f..313c12f9b 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux @@ -17,7 +17,7 @@ ["." jvm (#+ Inst Operation) ["_" inst]]]]]) -(def: #export bit +(def: .public bit (-> Bit (Operation Inst)) (let [Boolean (type.class "java.lang.Boolean" (list))] (function (_ value) @@ -33,7 +33,7 @@ (#static MAX_VALUE short) (#static MIN_VALUE short)]) -(def: #export (i64 value) +(def: .public (i64 value) (-> (I64 Any) (Operation Inst)) (case (.int value) (^template [<int> <instruction>] @@ -74,7 +74,7 @@ Int (java/lang/Double::doubleToRawLongBits +0.0)) -(def: #export (f64 value) +(def: .public (f64 value) (-> Frac (Operation Inst)) (case value (^template [<int> <instruction>] @@ -107,6 +107,6 @@ (_.double value))] (operation@in (|>> constantI (_.wrap type.double)))))) -(def: #export text +(def: .public text (-> Text (Operation Inst)) (|>> _.string operation@in)) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/program.lux b/lux-jvm/source/luxc/lang/translation/jvm/program.lux index 9cd8eeb82..8d95becc1 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/program.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/program.lux @@ -25,7 +25,7 @@ (def: ^Object ($t.class "java.lang.Object" (list))) -(def: #export (program artifact_name context programI) +(def: .public (program artifact_name context programI) (-> (-> Context Text) (Program _.Inst _.Definition)) (let [nilI runtime.noneI num_inputsI (|>> ($i.ALOAD 0) $i.ARRAYLENGTH) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux index b2dfe7676..f23fb56a3 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux @@ -28,7 +28,7 @@ ["#." runtime]]) (template [<name> <prefix>] - [(def: #export <name> + [(def: .public <name> (-> Nat Text) (|>> %.nat (format <prefix>)))] @@ -50,7 +50,7 @@ (-> Register Inst) (|>> _.ALOAD)) -(def: #export (variable archive variable) +(def: .public (variable archive variable) (-> Archive Variable (Operation Inst)) (case variable (#variable.Local variable) @@ -59,7 +59,7 @@ (#variable.Foreign variable) (foreign archive variable))) -(def: #export (constant archive name) +(def: .public (constant archive name) (-> Archive Name (Operation Inst)) (do {@ phase.monad} [class_name (\ @ map //.class_name diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux index e8f678211..13c5fe074 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux @@ -40,11 +40,11 @@ ["." // (#+ ByteCode)]) (def: $Text (type.class "java.lang.String" (list))) -(def: #export $Tag type.int) -(def: #export $Flag (type.class "java.lang.Object" (list))) -(def: #export $Value (type.class "java.lang.Object" (list))) -(def: #export $Index type.int) -(def: #export $Stack (type.array $Value)) +(def: .public $Tag type.int) +(def: .public $Flag (type.class "java.lang.Object" (list))) +(def: .public $Value (type.class "java.lang.Object" (list))) +(def: .public $Index type.int) +(def: .public $Stack (type.array $Value)) (def: $Throwable (type.class "java.lang.Throwable" (list))) (def: nullary_init_methodT @@ -53,7 +53,7 @@ (def: throw_methodT (type.method [(list) (list) type.void (list)])) -(def: #export logI +(def: .public logI Inst (let [PrintStream (type.class "java.io.PrintStream" (list)) outI (_.GETSTATIC (type.class "java.lang.System" (list)) "out" PrintStream) @@ -65,11 +65,11 @@ (def: variant_method (type.method [(list) (list $Tag $Flag $Value) //.$Variant (list)])) -(def: #export variantI +(def: .public variantI Inst (_.INVOKESTATIC //.$Runtime "variant_make" variant_method)) -(def: #export leftI +(def: .public leftI Inst (|>> _.ICONST_0 _.NULL @@ -77,7 +77,7 @@ _.POP2 variantI)) -(def: #export rightI +(def: .public rightI Inst (|>> _.ICONST_1 (_.string "") @@ -85,9 +85,9 @@ _.POP2 variantI)) -(def: #export someI Inst rightI) +(def: .public someI Inst rightI) -(def: #export noneI +(def: .public noneI Inst (|>> _.ICONST_0 _.NULL @@ -109,11 +109,11 @@ noneI _.ARETURN))) -(def: #export partials_field Text "partials") -(def: #export apply_method Text "apply") -(def: #export num_apply_variants Nat 8) +(def: .public partials_field Text "partials") +(def: .public apply_method Text "apply") +(def: .public num_apply_variants Nat 8) -(def: #export (apply_signature arity) +(def: .public (apply_signature arity) (-> Arity (Type Method)) (type.method [(list) (list.repeat arity $Value) $Value (list)])) @@ -292,7 +292,7 @@ ))) ))) -(def: #export try (type.method [(list) (list //.$Function) //.$Variant (list)])) +(def: .public try (type.method [(list) (list //.$Function) //.$Variant (list)])) (def: io_methods Def @@ -390,7 +390,7 @@ _ (generation.save! ..function_id #.None directive)] (in [..function_id #.None bytecode])))) -(def: #export translate +(def: .public translate (Operation [Registry Output]) (do phase.monad [runtime_payload ..translate_runtime diff --git a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux index 86b4431da..00a3539ca 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux @@ -37,15 +37,15 @@ ["." // ["#." runtime]]) -(exception: #export (not_a_tuple {size Nat}) +(exception: .public (not_a_tuple {size Nat}) (exception.report ["Expected size" ">= 2"] ["Actual size" (%.nat size)])) -(def: #export (tuple generate archive members) +(def: .public (tuple generate archive members) (Generator (List Synthesis)) (do {@ phase.monad} - [#let [size (list.size members)] + [.let [size (list.size members)] _ (phase.assertion ..not_a_tuple size (n.>= 2 size)) membersI (|> members @@ -72,7 +72,7 @@ (#static MAX_VALUE short) (#static MIN_VALUE short)]) -(def: #export (tagI lefts right?) +(def: .public (tagI lefts right?) (-> Nat Bit Inst) (case (if right? (.inc lefts) @@ -95,20 +95,20 @@ ## else (_.int tag))))) -(def: #export leftI _.NULL) -(def: #export rightI (_.string "")) +(def: .public leftI _.NULL) +(def: .public rightI (_.string "")) -(def: #export (flagI right?) +(def: .public (flagI right?) (-> Bit Inst) (if right? ..rightI ..leftI)) -(def: #export (variant generate archive [lefts right? member]) +(def: .public (variant generate archive [lefts right? member]) (Generator [Nat Bit Synthesis]) (do phase.monad [memberI (generate archive member) - #let [tagI (..tagI lefts right?)]] + .let [tagI (..tagI lefts right?)]] (in (|>> tagI (flagI right?) memberI |