From 891b1cfc82322f8017f0a4f6b707d6fe52024545 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 3 Sep 2021 21:51:30 -0400 Subject: Unified tuple and record syntax. --- lux-jvm/source/luxc/lang/directive/jvm.lux | 8 ++++---- lux-jvm/source/luxc/lang/host/jvm.lux | 32 ++++++++++++++++++------------ lux-jvm/source/program.lux | 12 +++++------ 3 files changed, 29 insertions(+), 23 deletions(-) (limited to 'lux-jvm/source') diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index 22715276b..8be0777a8 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -619,12 +619,12 @@ (type: Method_Declaration (Record - {#name Text + [#name Text #annotations (List Annotation) #type_variables (List (Type Var)) #exceptions (List (Type Class)) #arguments (List (Type Value)) - #return (Type Value)})) + #return (Type Value)])) (def: method_declaration (Parser Method_Declaration) @@ -819,9 +819,9 @@ (def: (constraint tv) (-> (Type Var) Constraint) - {#/type.name (parser.name tv) + [#/type.name (parser.name tv) #/type.super_class java/lang/Object - #/type.super_interfaces (list)}) + #/type.super_interfaces (list)]) (def: visibility (-> ffi.Privacy jvm.Visibility) diff --git a/lux-jvm/source/luxc/lang/host/jvm.lux b/lux-jvm/source/luxc/lang/host/jvm.lux index df9575ef4..44cc680eb 100644 --- a/lux-jvm/source/luxc/lang/host/jvm.lux +++ b/lux-jvm/source/luxc/lang/host/jvm.lux @@ -10,7 +10,7 @@ [data [binary (#+ Binary)] [collection - ["." list ("#/." functor)]]] + ["." list ("#\." monad)]]] [macro ["." code] [syntax (#+ syntax:)]] @@ -96,10 +96,10 @@ options (.tuple (<>.many .local_identifier))]) (let [g!type (code.local_identifier type) g!none (code.local_identifier none) - g!tags+ (list/each code.local_tag options) + g!tags+ (list\each code.local_tag options) g!_left (code.local_identifier "_left") g!_right (code.local_identifier "_right") - g!options+ (list/each (function (_ option) + g!options+ (list\each (function (_ option) (` (def: .public (~ (code.local_identifier option)) (~ g!type) (|> (~ g!none) @@ -107,22 +107,28 @@ options)] (in (list& (` (type: .public (~ g!type) (.Record - (~ (code.record (list/each (function (_ tag) - [tag (` .Bit)]) - g!tags+)))))) + (~ (|> g!tags+ + (list\each (function (_ tag) + (list tag (` .Bit)))) + list\conjoint + code.tuple))))) (` (def: .public (~ g!none) (~ g!type) - (~ (code.record (list/each (function (_ tag) - [tag (` #0)]) - g!tags+))))) + (~ (|> g!tags+ + (list\each (function (_ tag) + (list tag (` #0)))) + list\conjoint + code.tuple)))) (` (def: .public ((~ (code.local_identifier ++)) (~ g!_left) (~ g!_right)) (-> (~ g!type) (~ g!type) (~ g!type)) - (~ (code.record (list/each (function (_ tag) - [tag (` (or (value@ (~ tag) (~ g!_left)) - (value@ (~ tag) (~ g!_right))))]) - g!tags+))))) + (~ (|> g!tags+ + (list\each (function (_ tag) + (list tag (` (or (value@ (~ tag) (~ g!_left)) + (value@ (~ tag) (~ g!_right))))))) + list\conjoint + code.tuple)))) g!options+)))) diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux index 3a2e3a55b..304e2195f 100644 --- a/lux-jvm/source/program.lux +++ b/lux-jvm/source/program.lux @@ -234,14 +234,14 @@ [... host jvm/host.host [loader host] jvm.host] (in [loader - {#platform.&file_system (file.async file.default) + [#platform.&file_system (file.async file.default) #platform.host host ... #platform.phase jvm.generate #platform.phase expression.translate ... #platform.runtime runtime.generate #platform.runtime runtime.translate #platform.phase_wrapper ..phase_wrapper - #platform.write product.right}]))) + #platform.write product.right]]))) (def: (extender phase_wrapper) (-> phase.Wrapper Extender) @@ -277,16 +277,16 @@ (async.future (\ world/program.default exit +0))) (program: [service /cli.service] - (let [static {#/static.host @.jvm + (let [static [#/static.host @.jvm #/static.host_module_extension ".jvm" #/static.target (/cli.target service) - #/static.artifact_extension ".class"}] + #/static.artifact_extension ".class"]] (exec (do async.monad [[loader platform] (async.future ..platform) - _ (/.compiler {#/static.host @.jvm + _ (/.compiler [#/static.host @.jvm #/static.host_module_extension ".jvm" #/static.target (/cli.target service) - #/static.artifact_extension ".class"} + #/static.artifact_extension ".class"] ..expander (analysis.bundle loader) (io.io platform) -- cgit v1.2.3