From 63b45e09c5f5ceb59a48ed05cdc2d2c6cb038a7b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 24 Dec 2021 08:58:01 -0400 Subject: Dusting off the pure-Lux JVM compiler machinery. --- lux-jvm/commands.md | 4 +- .../luxc/lang/translation/jvm/extension/host.lux | 141 ++++++++++----------- 2 files changed, 72 insertions(+), 73 deletions(-) (limited to 'lux-jvm') diff --git a/lux-jvm/commands.md b/lux-jvm/commands.md index cf4e13b01..a4644f915 100644 --- a/lux-jvm/commands.md +++ b/lux-jvm/commands.md @@ -40,14 +40,14 @@ cd ~/lux/stdlib/ \ ``` cd ~/lux/lux-jvm/ \ -&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-jvm -Dversion=0.6.5 -Dpackaging=jar +&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-jvm -Dversion=0.7.0 -Dpackaging=jar cd ~/lux/lux-jvm/ && mvn deploy:deploy-file \ -Durl=https://USERNAME:PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \ -Dfile=target/program.jar \ -DgroupId=com.github.luxlang \ -DartifactId=lux-jvm \ --Dversion=0.6.1-SNAPSHOT \ +-Dversion=0.7.0-SNAPSHOT \ -Dpackaging=jar ``` 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 ee4096fe1..45bbce9f9 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -1104,77 +1104,76 @@ .let [all_dependencies (dependency.all ($_ list#composite all_input_dependencies all_closure_dependencies - all_method_dependencies))]] - (do [! phase.monad] - [[context _] (generation.with_new_context - archive - all_dependencies - (in [])) - .let [[module_id artifact_id] context - anonymous_class_name (///.class_name context) - class (type.class anonymous_class_name (list)) - total_environment (|> overriden_methods - ... Get all the environments. - (list#each product.left) - ... Combine them. - list#conjoint - ... Remove duplicates. - (set.of_list synthesis.hash) - set.list) - global_mapping (|> total_environment - ... Give them names as "foreign" variables. - list.enumeration - (list#each (function (_ [id capture]) - [capture {variable.#Foreign id}])) - (dictionary.of_list synthesis.hash)) - normalized_methods (list#each (function (_ [environment - [ownerT name - strict_fp? annotations vars - self_name arguments returnT exceptionsT - body]]) - (let [local_mapping (|> environment - list.enumeration - (list#each (function (_ [foreign_id capture]) - [(synthesis.variable/foreign foreign_id) - (|> global_mapping - (dictionary.value capture) - maybe.trusted)])) - (dictionary.of_list synthesis.hash))] - [ownerT name - strict_fp? annotations vars - self_name arguments returnT exceptionsT - (normalize_method_body local_mapping body)])) - overriden_methods)] - inputsTI (monad.each ! (generate_input generate archive) inputsTS) - method_definitions (|> normalized_methods - (monad.each ! (function (_ [ownerT name - strict_fp? annotations varsT - self_name arguments returnT exceptionsT - bodyS]) - (do ! - [bodyG (generation.with_context artifact_id - (generate archive bodyS)) - .let [argumentsT (list#each product.right arguments)]] - (in (_def.method {$.#Public} - (if strict_fp? - ($_ $.++M $.finalM $.strictM) - $.finalM) - name - (type.method [varsT argumentsT returnT exceptionsT]) - (|>> (prepare_arguments 1 argumentsT) - bodyG - (returnI returnT))))))) - (# ! each _def.fuse)) - .let [directive [anonymous_class_name - (_def.class {$.#V1_6} {$.#Public} $.finalC - anonymous_class_name (list) - super_class super_interfaces - (|>> (///function.with_environment total_environment) - (..with_anonymous_init class total_environment super_class inputsTI) - method_definitions))]] - _ (generation.execute! directive) - _ (generation.save! artifact_id {.#None} directive)] - (..anonymous_instance generate archive class total_environment))))])) + all_method_dependencies))] + [context _] (generation.with_new_context + archive + all_dependencies + (in [])) + .let [[module_id artifact_id] context + anonymous_class_name (///.class_name context) + class (type.class anonymous_class_name (list)) + total_environment (|> overriden_methods + ... Get all the environments. + (list#each product.left) + ... Combine them. + list#conjoint + ... Remove duplicates. + (set.of_list synthesis.hash) + set.list) + global_mapping (|> total_environment + ... Give them names as "foreign" variables. + list.enumeration + (list#each (function (_ [id capture]) + [capture {variable.#Foreign id}])) + (dictionary.of_list synthesis.hash)) + normalized_methods (list#each (function (_ [environment + [ownerT name + strict_fp? annotations vars + self_name arguments returnT exceptionsT + body]]) + (let [local_mapping (|> environment + list.enumeration + (list#each (function (_ [foreign_id capture]) + [(synthesis.variable/foreign foreign_id) + (|> global_mapping + (dictionary.value capture) + maybe.trusted)])) + (dictionary.of_list synthesis.hash))] + [ownerT name + strict_fp? annotations vars + self_name arguments returnT exceptionsT + (normalize_method_body local_mapping body)])) + overriden_methods)] + inputsTI (monad.each ! (generate_input generate archive) inputsTS) + method_definitions (|> normalized_methods + (monad.each ! (function (_ [ownerT name + strict_fp? annotations varsT + self_name arguments returnT exceptionsT + bodyS]) + (do ! + [bodyG (generation.with_context artifact_id + (generate archive bodyS)) + .let [argumentsT (list#each product.right arguments)]] + (in (_def.method {$.#Public} + (if strict_fp? + ($_ $.++M $.finalM $.strictM) + $.finalM) + name + (type.method [varsT argumentsT returnT exceptionsT]) + (|>> (prepare_arguments 1 argumentsT) + bodyG + (returnI returnT))))))) + (# ! each _def.fuse)) + .let [directive [anonymous_class_name + (_def.class {$.#V1_6} {$.#Public} $.finalC + anonymous_class_name (list) + super_class super_interfaces + (|>> (///function.with_environment total_environment) + (..with_anonymous_init class total_environment super_class inputsTI) + method_definitions))]] + _ (generation.execute! directive) + _ (generation.save! artifact_id {.#None} directive)] + (..anonymous_instance generate archive class total_environment)))])) (def: class_bundle Bundle -- cgit v1.2.3