From fc854233d2af07ed44a063a75a6900cc02616c74 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 18 Jan 2022 00:20:50 -0400 Subject: Fixes for the pure-Lux JVM compiler machinery. [Part 7] --- .../library/lux/target/jvm/encoding/signed.lux | 2 +- stdlib/source/library/lux/target/ruby.lux | 3 +- .../tool/compiler/language/lux/phase/extension.lux | 13 +++--- .../lux/phase/extension/generation/jvm/common.lux | 5 ++- .../lux/tool/compiler/language/lux/syntax.lux | 52 +++++++++++----------- 5 files changed, 38 insertions(+), 37 deletions(-) (limited to 'stdlib/source/library') diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index 027174fd1..f4f664878 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -61,7 +61,7 @@ (def: .public (-> Int (Try )) (let [positive (:representation ) - negative (|> (n.* i64.bits_per_byte) i64.mask i64.not)] + negative (i64.not positive)] (function (_ value) (if (i.= (if (i.< +0 value) (i64.or negative value) diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index 22cad3f00..eb3c30c2f 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -117,7 +117,8 @@ GVar (..global ))] - ["@" latest_error] + ["!" latest_error_message] + ["@" latest_error_location] ["_" last_string_read] ["." last_line_number_read] ["&" last_string_matched] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux index 84a4838b9..568e061a6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux @@ -94,14 +94,14 @@ (def: .public (install extender name handler) (All (_ s i o) - (-> (Extender s i o) Text (Handler s i o) (Operation s i o Any))) + (-> (Extender s i o) Name (Handler s i o) (Operation s i o Any))) (function (_ [bundle state]) - (case (dictionary.value name bundle) - {.#None} - {try.#Success [[(dictionary.has name (extender handler) bundle) state] + (case (dictionary.has' name (extender handler) bundle) + {try.#Success bundle'} + {try.#Success [[bundle' state] []]} - _ + {try.#Failure _} (exception.except ..cannot_overwrite name)))) (def: .public (with extender extensions) @@ -172,8 +172,7 @@ (def: .public (lifted action) (All (_ s i o v) - (-> (//.Operation s v) - (//.Operation [(Bundle s i o) s] v))) + (-> (//.Operation s v) (Operation s i o v))) (function (_ [bundle state]) (case (action state) {try.#Success [state' output]} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux index 25e88f063..aa59d8b01 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux @@ -118,7 +118,7 @@ ($_ _.composite (_.set_label @branch) branchG - (_.goto @end))]))) + (_.when_continuous (_.goto @end)))]))) conditionalsS)) .let [table (|> conditionalsG+ (list#each product.left) @@ -134,7 +134,8 @@ conditionalsG (_.set_label @else) elseG - (_.set_label @end) + (<| (_.when_acknowledged @end) + (_.set_label @end)) )))))])) (def: (lux::is [referenceG sampleG]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index e93e347e1..bd202b113 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -25,30 +25,30 @@ ... [file-name, line, column] to keep track of their provenance and ... location, which is helpful for documentation and debugging. (.using - [library - [lux "*" - ["@" target] - [abstract - monad] - [control - ["[0]" maybe] - ["[0]" exception {"+" exception:}] - [parser - [text {"+" Offset}]]] - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list] - ["[0]" dictionary {"+" Dictionary}]]] - [macro - ["[0]" template]] - [math - [number - ["n" nat] - ["[0]" int] - ["[0]" rev] - ["[0]" frac]]]]]) + [library + [lux "*" + ["@" target] + [abstract + monad] + [control + ["[0]" maybe] + ["[0]" exception {"+" exception:}] + [parser + [text {"+" Offset}]]] + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list] + ["[0]" dictionary {"+" Dictionary}]]] + [macro + ["[0]" template]] + [math + [number + ["n" nat] + ["[0]" int] + ["[0]" rev] + ["[0]" frac]]]]]) (template: (inline: ) [(for [@.python (def: ) @@ -583,5 +583,5 @@ ... Symbol (!full_symbol_parser offset/0 [] where aliases .#Symbol)) ))) - ))) - )) + )))) + ) -- cgit v1.2.3