diff options
author | Eduardo Julian | 2023-01-13 22:11:05 -0400 |
---|---|---|
committer | Eduardo Julian | 2023-01-13 22:11:05 -0400 |
commit | 0f9f87286acacb520aa3ab0252131e109184b4cb (patch) | |
tree | 69b21f7466ef4418ee6e696998dda0fcb78d26e3 /stdlib/source/library/lux/meta/compiler/language | |
parent | 03eb09c1e0c6de32e45579a1adaf58c9046e632f (diff) |
Better formatting for types & symbols for compilation logging.
Diffstat (limited to 'stdlib/source/library/lux/meta/compiler/language')
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux | 6 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux | 11 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux | 6 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/complex.lux (renamed from stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/structure.lux) | 58 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux | 4 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/when.lux | 6 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/python.lux | 5 |
7 files changed, 51 insertions, 45 deletions
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux index d71d0b0c6..acb4a676e 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux @@ -1,10 +1,10 @@ +... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. + (.require [library [lux (.except Tag Analysis) [abstract -... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. - ["[0]" monad (.only do)]] [control ["[0]" maybe] diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux index 2fffba00c..1a8b75275 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux @@ -16,7 +16,7 @@ ["[0]" binary] ["[0]" product] ["[0]" text - ["%" \\format (.only format)]] + ["%" \\format]] [collection ["[0]" dictionary] ["[0]" array] @@ -192,11 +192,12 @@ (in [])))] (in []))) -(def (announce_definition! short type) +(def (announce_definition! module short type) (All (_ anchor expression declaration) - (-> Text Type (Operation anchor expression declaration Any))) + (-> Text Text Type + (Operation anchor expression declaration Any))) (/////declaration.of_translation - (/////translation.log! (format short " : " (%.type type))))) + (/////translation.log! (%.format short " : " (type.relative_format module type))))) (def lux::def Handler @@ -233,7 +234,7 @@ [_ _ exported?] (evaluate! archive Bit exported?C) _ (/////declaration.of_analysis (moduleA.define short_name [(as Bit exported?) {.#Definition [type value]}])) - _ (..announce_definition! short_name type)] + _ (..announce_definition! current_module short_name type)] (in /////declaration.no_requirements))))])) (def imports diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux index 4ddfd3fd4..15a4a8057 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux @@ -29,7 +29,7 @@ ["[0]" / [runtime (.only Operation Phase Handler)] ["[1][0]" primitive] - ["[1][0]" structure] + ["[1][0]" complex] ["[1][0]" reference] ["[1][0]" function] ["[1][0]" when] @@ -73,11 +73,11 @@ (synthesis.variant @ variantS) (with_source_mapping @ - (/structure.variant phase archive variantS)) + (/complex.variant phase archive variantS)) (synthesis.tuple @ members) (with_source_mapping @ - (/structure.tuple phase archive members)) + (/complex.tuple phase archive members)) [@ {synthesis.#Reference reference}] (with_source_mapping @ diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/structure.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/complex.lux index b06724932..a449ffa45 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/structure.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/complex.lux @@ -32,34 +32,9 @@ [analysis [complex (.only Variant Tuple)]]]]) -(def .public (tuple phase archive membersS) - (Translator (Tuple Synthesis)) - (when membersS - {.#End} - (of phase.monad in //runtime.unit) - - {.#Item singletonS {.#End}} - (phase archive singletonS) - - _ - (do [! phase.monad] - [membersI (|> membersS - list.enumeration - (monad.each ! (function (_ [idx member]) - (do ! - [memberI (phase archive member)] - (in (do _.monad - [_ _.dup - _ (_.int (.i64 idx)) - _ memberI] - _.aastore))))))] - (in (do [! _.monad] - [_ (_.int (.i64 (list.size membersS))) - _ (_.anewarray //type.value)] - (monad.all ! membersI)))))) - (def .public (lefts lefts) - (-> Nat (Bytecode Any)) + (-> Nat + (Bytecode Any)) (when lefts 0 _.iconst_0 1 _.iconst_1 @@ -80,7 +55,8 @@ (_.int (.i64 lefts)))))) (def .public (right? right?) - (-> Bit (Bytecode Any)) + (-> Bit + (Bytecode Any)) (if right? //runtime.right_right? //runtime.left_right?)) @@ -98,3 +74,29 @@ (list //type.lefts //type.right? //type.value) //type.variant (list)])))))) + +(def .public (tuple phase archive membersS) + (Translator (Tuple Synthesis)) + (when membersS + {.#End} + (of phase.monad in //runtime.unit) + + {.#Item singletonS {.#End}} + (phase archive singletonS) + + _ + (do [! phase.monad] + [membersI (|> membersS + list.enumeration + (monad.each ! (function (_ [idx member]) + (do ! + [memberI (phase archive member)] + (in (do _.monad + [_ _.dup + _ (_.int (.i64 idx)) + _ memberI] + _.aastore))))))] + (in (do [! _.monad] + [_ (_.int (.i64 (list.size membersS))) + _ (_.anewarray //type.value)] + (monad.all ! membersI)))))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux index 86ffa8239..fdcf78041 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux @@ -137,10 +137,12 @@ ..double_bits (i.= ..d0_bits)) _.dconst_0 - (_.double (as java/lang/Double value)))] + (_.double value))] (do _.monad [_ constantI] ..wrap_f64)))) (def .public text + (-> Text + (Bytecode Any)) _.string) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/when.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/when.lux index c2d2536b4..558353ad8 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/when.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/when.lux @@ -33,7 +33,7 @@ ["[1][0]" type] ["[1][0]" runtime (.only Operation Phase Translator)] ["[1][0]" value] - ["[1][0]" structure] + ["[1][0]" complex] [//// ["[0]" phase (.use "operation#[0]" monad)] ["[0]" translation] @@ -195,8 +195,8 @@ (all _.composite ..peek (_.checkcast //type.variant) - (//structure.lefts lefts) - (//structure.right? right?) + (//complex.lefts lefts) + (//complex.right? right?) //runtime.when _.dup (_.ifnonnull @success) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/python.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/python.lux index 355b45be8..389716606 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/python.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/python.lux @@ -11,8 +11,9 @@ [meta [macro ["^" pattern]] - [target - ["_" python]]]]] + [compiler + [target + ["_" python]]]]]] ["[0]" / [runtime (.only Phase)] ["[1][0]" primitive] |