diff options
Diffstat (limited to 'lux-jvm')
19 files changed, 160 insertions, 160 deletions
diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index 93a356c0e..000a5808f 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -531,7 +531,7 @@ ..relabel_bytecode product.right (row\map ..instruction) - row.to_list + row.list _.fuse)) (with_expansions [<anchor> (as_is jvm.Anchor) @@ -580,7 +580,7 @@ _ (phase.except extension.invalid_syntax [extension_name %.code inputsC+])))) -(def: #export (custom [parser handler]) +(def: .public (custom [parser handler]) (All [i] (-> [(Parser i) (-> Text ..Phase Archive i (..Operation Requirements))] @@ -1008,7 +1008,7 @@ (def: (constructor_method_analysis archive [class_name class_tvars] method) (-> Archive Declaration (Constructor Code) (Operation (Constructor Analysis))) (do {! phase.monad} - [#let [[privacy strict_floating_point? annotations method_tvars exceptions + [.let [[privacy strict_floating_point? annotations method_tvars exceptions self arguments constructor_argumentsC bodyC] method] analyse directive.analysis] @@ -1043,14 +1043,14 @@ (def: (override_method_analysis archive [class_name class_tvars] supers method) (-> Archive Declaration (List (Type Class)) (Override Code) (Operation (Override Analysis))) (do {! phase.monad} - [#let [[[super_name super_tvars] method_name strict_floating_point? annotations + [.let [[[super_name super_tvars] method_name strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ bodyC] method] analyse directive.analysis] (directive.lift_analysis (do ! [mapping (//A.with_fresh_type_vars class_tvars luxT.fresh) - #let [parent_type (/type.class super_name super_tvars)] + .let [parent_type (/type.class super_name super_tvars)] mapping (//A.with_override_mapping supers parent_type mapping) mapping (//A.with_fresh_type_vars method_tvars mapping) selfT (//A.reflection_type mapping (/type.class class_name class_tvars)) @@ -1073,7 +1073,7 @@ (def: (virtual_method_analysis archive [class_name class_tvars] method) (-> Archive Declaration (Virtual Code) (Operation (Virtual Analysis))) (do {! phase.monad} - [#let [[name privacy final? strict_floating_point? annotations method_tvars + [.let [[name privacy final? strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ bodyC] method] analyse directive.analysis] @@ -1101,7 +1101,7 @@ (def: (static_method_analysis archive method) (-> Archive (Static Code) (Operation (Static Analysis))) (do {! phase.monad} - [#let [[name privacy strict_floating_point? annotations method_tvars + [.let [[name privacy strict_floating_point? annotations method_tvars arguments returnJ exceptionsJ bodyC] method] analyse directive.analysis] @@ -1156,7 +1156,7 @@ (def: (constructor_method_synthesis archive method) (-> Archive (Constructor Analysis) (Operation (Constructor Synthesis))) (do {! phase.monad} - [#let [[privacy strict_floating_point? annotations method_tvars exceptions + [.let [[privacy strict_floating_point? annotations method_tvars exceptions self arguments constructor_argumentsA bodyA] method] synthesise directive.synthesis] @@ -1179,7 +1179,7 @@ (def: (override_method_synthesis archive method) (-> Archive (Override Analysis) (Operation (Override Synthesis))) (do {! phase.monad} - [#let [[[super_name super_tvars] method_name strict_floating_point? annotations + [.let [[[super_name super_tvars] method_name strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ bodyA] method] synthesise directive.synthesis] @@ -1198,7 +1198,7 @@ (def: (virtual_method_synthesis archive method) (-> Archive (Virtual Analysis) (Operation (Virtual Synthesis))) (do {! phase.monad} - [#let [[name privacy final? strict_floating_point? annotations method_tvars + [.let [[name privacy final? strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ bodyA] method] synthesise directive.synthesis] @@ -1217,7 +1217,7 @@ (def: (static_method_synthesis archive method) (-> Archive (Static Analysis) (Operation (Static Synthesis))) (do {! phase.monad} - [#let [[name privacy strict_floating_point? annotations method_tvars + [.let [[name privacy strict_floating_point? annotations method_tvars arguments returnJ exceptionsJ bodyA] method] synthesise directive.synthesis] @@ -1259,7 +1259,7 @@ (def: (constructor_method_generation archive super_class method) (-> Archive (Type Class) (Constructor Synthesis) (Operation jvm.Def)) (do {! phase.monad} - [#let [[privacy strict_floating_point? annotations method_tvars exceptions + [.let [[privacy strict_floating_point? annotations method_tvars exceptions self arguments constructor_argumentsS bodyS] method] generate directive.generation] @@ -1268,7 +1268,7 @@ [constructor_argumentsG (monad.map ! (|>> product.right (generate archive)) constructor_argumentsS) bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS)) - #let [[super_name super_vars] (parser.read_class super_class) + .let [[super_name super_vars] (parser.read_class super_class) super_constructor_argument_values (_.fuse constructor_argumentsG) super_constructorT (/type.method [(list) (list\map product.left constructor_argumentsS) @@ -1293,14 +1293,14 @@ (def: (override_method_generation archive method) (-> Archive (Override Synthesis) (Operation jvm.Def)) (do {! phase.monad} - [#let [[[super_name super_tvars] method_name strict_floating_point? annotations + [.let [[[super_name super_tvars] method_name strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ bodyS] method] generate directive.generation] (directive.lift_generation (do ! [bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS)) - #let [argumentsT (list\map product.right arguments)]] + .let [argumentsT (list\map product.right arguments)]] (in (def.method #jvm.Public (if strict_floating_point? jvm.strictM @@ -1314,14 +1314,14 @@ (def: (virtual_method_generation archive method) (-> Archive (Virtual Synthesis) (Operation jvm.Def)) (do {! phase.monad} - [#let [[method_name privacy final? strict_floating_point? annotations method_tvars + [.let [[method_name privacy final? strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ bodyS] method] generate directive.generation] (directive.lift_generation (do ! [bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS)) - #let [argumentsT (list\map product.right arguments)]] + .let [argumentsT (list\map product.right arguments)]] (in (def.method (..visibility privacy) (|> jvm.noneM (jvm.++M (if strict_floating_point? @@ -1339,14 +1339,14 @@ (def: (static_method_generation archive method) (-> Archive (Static Synthesis) (Operation jvm.Def)) (do {! phase.monad} - [#let [[method_name privacy strict_floating_point? annotations method_tvars + [.let [[method_name privacy strict_floating_point? annotations method_tvars arguments returnJ exceptionsJ bodyS] method] generate directive.generation] (directive.lift_generation (do ! [bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS)) - #let [argumentsT (list\map product.right arguments)]] + .let [argumentsT (list\map product.right arguments)]] (in (def.method (..visibility privacy) (|> jvm.staticM (jvm.++M (if strict_floating_point? @@ -1413,7 +1413,7 @@ fields methodsC]) (do {! phase.monad} - [#let [[class_name type_variables] declaration + [.let [[class_name type_variables] declaration header (..header [class_name type_variables] super_class super_interfaces @@ -1423,7 +1423,7 @@ ## Necessary for reflection to work properly during analysis. _ (directive.lift_generation (generation.execute! header)) - #let [supers (: (List (Type Class)) + .let [supers (: (List (Type Class)) (list& super_class super_interfaces))] _ (|> methodsC (list.all ..convert_overriden_method) @@ -1432,7 +1432,7 @@ methodsA (monad.map ! (method_analysis archive declaration supers) methodsC) methodsS (monad.map ! (method_synthesis archive) methodsA) methodsG (monad.map ! (method_generation archive super_class) methodsS) - #let [directive [class_name + .let [directive [class_name (def.class #jvm.V1_6 #jvm.Public jvm.noneC class_name (list\map ..constraint type_variables) super_class @@ -1457,7 +1457,7 @@ (<>.some ..method_declaration)) (function (_ extension_name phase archive [[class_name type_variables] supers annotations method_declarations]) (do {! phase.monad} - [#let [directive [class_name + [.let [directive [class_name (def.interface #jvm.V1_6 #jvm.Public jvm.noneC class_name (list\map ..constraint type_variables) supers @@ -1474,7 +1474,7 @@ _ (generation.log! (format "JVM Interface " (%.text class_name)))] (in directive.no_requirements)))))])) -(def: #export (bundle class_loader extender) +(def: .public (bundle class_loader extender) (-> java/lang/ClassLoader jvm.Extender (directive.Bundle jvm.Anchor jvm.Inst jvm.Definition)) (|> bundle.empty (dictionary.put "lux def generation" (..def::generation extender)) diff --git a/lux-jvm/source/luxc/lang/host/jvm.lux b/lux-jvm/source/luxc/lang/host/jvm.lux index 5c854d646..a9b73c8b0 100644 --- a/lux-jvm/source/luxc/lang/host/jvm.lux +++ b/lux-jvm/source/luxc/lang/host/jvm.lux @@ -36,22 +36,22 @@ ["#::." (new [])]) -(type: #export Def +(type: .public Def (-> org/objectweb/asm/ClassWriter org/objectweb/asm/ClassWriter)) -(type: #export Inst +(type: .public Inst (-> org/objectweb/asm/MethodVisitor org/objectweb/asm/MethodVisitor)) -(type: #export Label +(type: .public Label org/objectweb/asm/Label) -(type: #export Visibility +(type: .public Visibility #Public #Protected #Private #Default) -(type: #export Version +(type: .public Version #V1_1 #V1_2 #V1_3 @@ -61,20 +61,20 @@ #V1_7 #V1_8) -(type: #export ByteCode +(type: .public ByteCode Binary) -(type: #export Definition +(type: .public Definition [Text ByteCode]) -(type: #export Anchor +(type: .public Anchor [Label Register]) -(type: #export Host +(type: .public Host (generation.Host Inst Definition)) (template [<name> <base>] - [(type: #export <name> + [(type: .public <name> (<base> ..Anchor ..Inst ..Definition))] [State generation.State] @@ -85,7 +85,7 @@ [Extender generation.Extender] ) -(type: #export (Generator i) +(type: .public (Generator i) (-> Phase Archive i (Operation Inst))) (syntax: (config: {type <code>.local_identifier} @@ -98,23 +98,23 @@ g!_left (code.local_identifier "_left") g!_right (code.local_identifier "_right") g!options+ (list/map (function (_ option) - (` (def: (~' #export) (~ (code.local_identifier option)) + (` (def: .public (~ (code.local_identifier option)) (~ g!type) (|> (~ g!none) (set@ (~ (code.local_tag option)) #1))))) options)] - (in (list& (` (type: (~' #export) (~ g!type) + (in (list& (` (type: .public (~ g!type) (~ (code.record (list/map (function (_ tag) [tag (` .Bit)]) g!tags+))))) - (` (def: (~' #export) (~ g!none) + (` (def: .public (~ g!none) (~ g!type) (~ (code.record (list/map (function (_ tag) [tag (` #0)]) g!tags+))))) - (` (def: (~' #export) ((~ (code.local_identifier ++)) (~ g!_left) (~ g!_right)) + (` (def: .public ((~ (code.local_identifier ++)) (~ g!_left) (~ g!_right)) (-> (~ g!type) (~ g!type) (~ g!type)) (~ (code.record (list/map (function (_ tag) [tag (` (or (get@ (~ tag) (~ g!_left)) @@ -127,11 +127,11 @@ (config: Method_Config noneM ++M [finalM staticM synchronizedM strictM]) (config: Field_Config noneF ++F [finalF staticF transientF volatileF]) -(def: #export new_label +(def: .public new_label (-> Any Label) (function (_ _) (org/objectweb/asm/Label::new))) -(def: #export (simple_class name) +(def: .public (simple_class name) (-> Text (Type Class)) (type.class name (list))) diff --git a/lux-jvm/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux index e1e60179f..939a8cb91 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/def.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux @@ -166,7 +166,7 @@ (def: binary_name (|>> name.internal name.read)) (template [<name> <flag>] - [(def: #export (<name> version visibility config name constraints super interfaces + [(def: .public (<name> version visibility config name constraints super interfaces definitions) (-> //.Version //.Visibility //.Class_Config Text (List Constraint) (Type Class) (List (Type Class)) //.Def (ffi.type [byte])) @@ -195,7 +195,7 @@ (Type Class) (type.class "java.lang.Object" (list))) -(def: #export (interface version visibility config name constraints interfaces +(def: .public (interface version visibility config name constraints interfaces definitions) (-> //.Version //.Visibility //.Class_Config Text (List Constraint) (List (Type Class)) //.Def (ffi.type [byte])) @@ -216,7 +216,7 @@ _ (org/objectweb/asm/ClassWriter::visitEnd writer)] (org/objectweb/asm/ClassWriter::toByteArray writer))) -(def: #export (method visibility config name type then) +(def: .public (method visibility config name type then) (-> //.Visibility //.Method_Config Text (Type Method) //.Inst //.Def) (function (_ writer) @@ -234,7 +234,7 @@ _ (org/objectweb/asm/MethodVisitor::visitEnd =method)] writer))) -(def: #export (abstract_method visibility config name type) +(def: .public (abstract_method visibility config name type) (-> //.Visibility //.Method_Config Text (Type Method) //.Def) (function (_ writer) @@ -250,7 +250,7 @@ _ (org/objectweb/asm/MethodVisitor::visitEnd =method)] writer))) -(def: #export (field visibility config name type) +(def: .public (field visibility config name type) (-> //.Visibility //.Field_Config Text (Type Value) //.Def) (function (_ writer) (let [=field (do_to (org/objectweb/asm/ClassWriter::visitField ($_ i.+ @@ -265,7 +265,7 @@ writer))) (template [<name> <lux_type> <jvm_type> <prepare>] - [(def: #export (<name> visibility config name value) + [(def: .public (<name> visibility config name value) (-> //.Visibility //.Field_Config Text <lux_type> //.Def) (function (_ writer) (let [=field (do_to (org/objectweb/asm/ClassWriter::visitField ($_ i.+ @@ -290,7 +290,7 @@ [string_field Text (type.class "java.lang.String" (list)) function.identity] ) -(def: #export (fuse defs) +(def: .public (fuse defs) (-> (List //.Def) //.Def) (case defs #.End diff --git a/lux-jvm/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux index ea68f2680..1a2c811a3 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/inst.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux @@ -149,17 +149,17 @@ ]) ## [Insts] -(def: #export make_label +(def: .public make_label (All [s] (Operation s org/objectweb/asm/Label)) (function (_ state) (#try.Success [state (org/objectweb/asm/Label::new)]))) -(def: #export (with_label action) +(def: .public (with_label action) (All [a] (-> (-> org/objectweb/asm/Label a) a)) (action (org/objectweb/asm/Label::new))) (template [<name> <type> <prepare>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> <type> Inst) (function (_ visitor) (do_to visitor @@ -177,7 +177,7 @@ (`` ((~~ (template.identifier ["org/objectweb/asm/Opcodes::" short]))))) (template [<constant>] - [(def: #export <constant> + [(def: .public <constant> Inst (function (_ visitor) (do_to visitor @@ -189,14 +189,14 @@ [DCONST_0] [DCONST_1] ) -(def: #export NULL +(def: .public NULL Inst (function (_ visitor) (do_to visitor (org/objectweb/asm/MethodVisitor::visitInsn (!prefix ACONST_NULL))))) (template [<constant>] - [(def: #export (<constant> constant) + [(def: .public (<constant> constant) (-> Int Inst) (function (_ visitor) (do_to visitor @@ -207,7 +207,7 @@ ) (template [<name>] - [(def: #export <name> + [(def: .public <name> Inst (function (_ visitor) (do_to visitor @@ -267,10 +267,10 @@ [RETURN] [IRETURN] [LRETURN] [FRETURN] [DRETURN] [ARETURN] ) -(type: #export Register Nat) +(type: .public Register Nat) (template [<name>] - [(def: #export (<name> register) + [(def: .public (<name> register) (-> Register Inst) (function (_ visitor) (do_to visitor @@ -282,7 +282,7 @@ ) (template [<name> <inst>] - [(def: #export (<name> class field type) + [(def: .public (<name> class field type) (-> (Type Class) Text (Type Value) Inst) (function (_ visitor) (do_to visitor @@ -297,7 +297,7 @@ (template [<category> <instructions>+] [(`` (template [<name> <inst>] - [(def: #export (<name> class) + [(def: .public (<name> class) (-> (Type <category>) Inst) (function (_ visitor) (do_to visitor @@ -314,7 +314,7 @@ [INSTANCEOF org/objectweb/asm/Opcodes::INSTANCEOF]]] ) -(def: #export (NEWARRAY type) +(def: .public (NEWARRAY type) (-> (Type Primitive) Inst) (function (_ visitor) (do_to visitor @@ -334,7 +334,7 @@ (undefined))))))) (template [<name> <inst> <interface?>] - [(def: #export (<name> class method_name method) + [(def: .public (<name> class method_name method) (-> (Type Class) Text (Type Method) Inst) (function (_ visitor) (do_to visitor @@ -351,7 +351,7 @@ ) (template [<name>] - [(def: #export (<name> @where) + [(def: .public (<name> @where) (-> //.Label Inst) (function (_ visitor) (do_to visitor @@ -364,7 +364,7 @@ [GOTO] ) -(def: #export (LOOKUPSWITCH default keys+labels) +(def: .public (LOOKUPSWITCH default keys+labels) (-> //.Label (List [Int //.Label]) Inst) (function (_ visitor) (let [keys+labels (list.sort (function (_ left right) @@ -384,7 +384,7 @@ (do_to visitor (org/objectweb/asm/MethodVisitor::visitLookupSwitchInsn default keys_array labels_array))))) -(def: #export (TABLESWITCH min max default labels) +(def: .public (TABLESWITCH min max default labels) (-> Int Int //.Label (List //.Label) Inst) (function (_ visitor) (let [num_labels (list.size labels) @@ -399,19 +399,19 @@ (do_to visitor (org/objectweb/asm/MethodVisitor::visitTableSwitchInsn min max default labels_array))))) -(def: #export (try @from @to @handler exception) +(def: .public (try @from @to @handler exception) (-> //.Label //.Label //.Label (Type Class) Inst) (function (_ visitor) (do_to visitor (org/objectweb/asm/MethodVisitor::visitTryCatchBlock @from @to @handler (..class_name exception))))) -(def: #export (label @label) +(def: .public (label @label) (-> //.Label Inst) (function (_ visitor) (do_to visitor (org/objectweb/asm/MethodVisitor::visitLabel @label)))) -(def: #export (array elementT) +(def: .public (array elementT) (-> (Type Value) Inst) (case (type.primitive? elementT) (#.Left elementT) @@ -445,18 +445,18 @@ "longValue" "floatValue" "doubleValue" "charValue"] ) -(def: #export (wrap type) +(def: .public (wrap type) (-> (Type Primitive) Inst) (let [wrapper (type.class (primitive_wrapper type) (list))] (INVOKESTATIC wrapper "valueOf" (type.method [(list) (list type) wrapper (list)])))) -(def: #export (unwrap type) +(def: .public (unwrap type) (-> (Type Primitive) Inst) (let [wrapper (type.class (primitive_wrapper type) (list))] (|>> (CHECKCAST wrapper) (INVOKEVIRTUAL wrapper (primitive_unwrap type) (type.method [(list) (list) type (list)]))))) -(def: #export (fuse insts) +(def: .public (fuse insts) (-> (List Inst) Inst) (case insts #.End 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 diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux index 6442a87e7..e5be7649c 100644 --- a/lux-jvm/source/program.lux +++ b/lux-jvm/source/program.lux @@ -112,7 +112,7 @@ (ffi.array_write 3 _object_class) (ffi.array_write 4 _object_class))) -(def: #export (expander macro inputs lux) +(def: .public (expander macro inputs lux) Expander (do try.monad [apply_method (|> macro @@ -226,7 +226,7 @@ (ffi.array_write 0 (:as java/lang/Object phase))) apply_method))))))) -(def: #export platform +(def: .public platform ## (IO (Platform Anchor (Bytecode Any) Definition)) (IO [java/lang/ClassLoader (Platform _.Anchor _.Inst _.Definition)]) |