diff options
Diffstat (limited to '')
5 files changed, 56 insertions, 38 deletions
diff --git a/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux b/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux index 884ef7302..a55e7b2b5 100644 --- a/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux +++ b/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux @@ -170,7 +170,7 @@ (bundle.install "*" (binary Int Int Int)) (bundle.install "/" (binary Int Int Int)) (bundle.install "%" (binary Int Int Int)) - (bundle.install "<" (binary Int Int Int)) + (bundle.install "<" (binary Int Int Bit)) (bundle.install "to-frac" (unary Int Frac)) (bundle.install "char" (unary Int Text))))) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis.lux b/stdlib/source/lux/compiler/default/phase/synthesis.lux index da5cad094..cf29ad74b 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis.lux @@ -310,29 +310,35 @@ (def: #export (%synthesis value) (Format Synthesis) (case value - (^template [<pattern> <format>] - (^ (<pattern> value)) - (<format> value)) - ([..bit %b] - [..f64 %f] - [..text %t]) - - (^ (..i64 value)) - (%i (.int value)) - - (^ (..variant [lefts right? content])) - (|> (%synthesis content) - (format (%n lefts) " " (%b right?) " ") - (text.enclose ["(" ")"])) - - (^ (..tuple members)) - (|> members - (list/map %synthesis) - (text.join-with " ") - (text.enclose ["[" "]"])) + (#Primitive primitive) + (case primitive + (^template [<pattern> <format>] + (<pattern> value) + (<format> value)) + ([#Bit %b] + [#F64 %f] + [#Text %t]) + + (#I64 value) + (%i (.int value))) + + (#Structure structure) + (case structure + (#analysis.Variant [lefts right? content]) + (|> (%synthesis content) + (format (%n lefts) " " (%b right?) " ") + (text.enclose ["(" ")"])) + + (#analysis.Tuple members) + (|> members + (list/map %synthesis) + (text.join-with " ") + (text.enclose ["[" "]"]))) (#Reference reference) - (reference.%reference reference) + (|> reference + reference.%reference + (text.enclose ["(#@ " ")"])) (#Control control) (case control @@ -354,8 +360,20 @@ (format (%synthesis func) " ") (text.enclose ["(" ")"]))) - ## (%path' %synthesis ...) - ## (#Branch branch) + (#Branch branch) + (case branch + (#Let input register body) + (|> (format (%synthesis input) " " (%n register) " " (%synthesis body)) + (text.enclose ["(#let " ")"])) + + (#If test then else) + (|> (format (%synthesis test) " " (%synthesis then) " " (%synthesis else)) + (text.enclose ["(#if " ")"])) + + (#Case input path) + (|> (format (%synthesis input) " " (%path' %synthesis path)) + (text.enclose ["(#case " ")"]))) + ## (#Loop loop) _ "???") diff --git a/stdlib/source/lux/compiler/default/phase/synthesis/function.lux b/stdlib/source/lux/compiler/default/phase/synthesis/function.lux index 196d959ed..267d941fc 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis/function.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis/function.lux @@ -79,7 +79,7 @@ [left' (grow-path grow left) right' (grow-path grow right)] (wrap (<tag> left' right')))) - ([#//.Alt] [#//.Alt]) + ([#//.Alt] [#//.Seq]) (#//.Then thenS) (|> thenS @@ -95,7 +95,7 @@ (function (_ variable) (case variable (#reference.Local register) - (operation/wrap variable) + (operation/wrap (#reference.Local (inc register))) (#reference.Foreign register) (find-foreign super register))) diff --git a/stdlib/source/lux/compiler/default/phase/translation.lux b/stdlib/source/lux/compiler/default/phase/translation.lux index 1dcd351c8..b1a224e80 100644 --- a/stdlib/source/lux/compiler/default/phase/translation.lux +++ b/stdlib/source/lux/compiler/default/phase/translation.lux @@ -102,7 +102,7 @@ (Operation anchor expression statement [Text output]))) (function (_ [bundle state]) (let [[old-scope old-inner] (get@ #context state) - new-scope (format old-scope "c___" (%i (.int old-inner)))] + new-scope (format old-scope "c" (%n old-inner))] (case (expr [bundle (set@ #context [new-scope 0] state)]) (#error.Success [[bundle' state'] output]) (#error.Success [[bundle' (set@ #context [old-scope (inc old-inner)] state')] diff --git a/stdlib/source/lux/compiler/default/syntax.lux b/stdlib/source/lux/compiler/default/syntax.lux index 09db624df..7556e7e46 100644 --- a/stdlib/source/lux/compiler/default/syntax.lux +++ b/stdlib/source/lux/compiler/default/syntax.lux @@ -609,17 +609,17 @@ (do p.Monad<Parser> [where (left-padding^ where)] ($_ p.either - (form where ast') - (tuple where ast') - (record where ast') - (identifier current-module aliases where) - (tag current-module aliases where) - (text where) - (nat where) - (int where) - (frac where) - (rev where) - (bit where) + (..form where ast') + (..tuple where ast') + (..record where ast') + (..text where) + (..nat where) + (..int where) + (..frac where) + (..rev where) + (..bit where) + (..identifier current-module aliases where) + (..tag current-module aliases where) (do @ [end? l.end?] (if end? |