From 7c53a09d0ba1e443dd60dfdc4b8d8b134fcd120c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 9 Jul 2018 23:01:12 -0400 Subject: - Fixes: Part 2. --- .../lang/compiler/translation/scheme/case.jvm.lux | 8 ++--- .../compiler/translation/scheme/expression.jvm.lux | 31 +++++++++---------- .../compiler/translation/scheme/extension.jvm.lux | 8 ++--- .../translation/scheme/extension/common.jvm.lux | 6 ++-- .../compiler/translation/scheme/function.jvm.lux | 12 ++++---- .../lang/compiler/translation/scheme/loop.jvm.lux | 35 ++++++++++------------ .../compiler/translation/scheme/primitive.jvm.lux | 4 +-- .../compiler/translation/scheme/reference.jvm.lux | 12 ++++---- .../compiler/translation/scheme/runtime.jvm.lux | 10 +++---- .../compiler/translation/scheme/structure.jvm.lux | 8 ++--- stdlib/source/lux/macro/poly/functor.lux | 4 +-- stdlib/source/lux/macro/poly/json.lux | 4 +-- stdlib/source/lux/type/quotient.lux | 2 +- stdlib/source/lux/type/unit.lux | 2 +- 14 files changed, 72 insertions(+), 74 deletions(-) (limited to 'stdlib/source') diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux index 40d2625fb..0ee52c54b 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux @@ -7,10 +7,10 @@ text/format (coll [list "list/" Functor Fold] (set ["set" unordered #+ Set])))) - (//// [reference #+ Register] - (host ["_" scheme #+ Expression Computation Var]) - [compiler #+ "operation/" Monad] - [synthesis #+ Synthesis Path]) + (///// [reference #+ Register] + (host ["_" scheme #+ Expression Computation Var]) + [compiler #+ "operation/" Monad] + (compiler [synthesis #+ Synthesis Path])) [//runtime #+ Operation Translator] [//reference]) diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/expression.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/expression.jvm.lux index 96bb17126..a654fe4d0 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/expression.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/expression.jvm.lux @@ -1,15 +1,16 @@ (.module: lux (lux (control [monad #+ do])) - (//// [compiler] - [synthesis] - [extension]) + (///// [compiler] + (compiler [synthesis] + [extension])) [//runtime #+ Translator] [//primitive] [//structure] [//reference] [//function] - [//case]) + [//case] + [//loop]) (def: #export (translate synthesis) Translator @@ -31,12 +32,6 @@ (#synthesis.Reference reference) (//reference.reference reference) - (^ (synthesis.function/apply application)) - (//function.apply translate application) - - (^ (synthesis.function/abstraction abstraction)) - (//function.function translate abstraction) - (^ (synthesis.branch/case case)) (//case.case translate case) @@ -46,8 +41,14 @@ (^ (synthesis.branch/if if)) (//case.if translate if) - (#synthesis.Extension [extension argsS]) - (do compiler.Monad - [extension (extension.find-translation extension)] - (extension argsS)) - )) + (^ (synthesis.loop/scope scope)) + (//loop.scope translate scope) + + (^ (synthesis.loop/recur updates)) + (//loop.recur translate updates) + + (^ (synthesis.function/abstraction abstraction)) + (//function.function translate abstraction) + + (^ (synthesis.function/apply application)) + (//function.apply translate application))) diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/extension.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/extension.jvm.lux index 6475caf68..e2cdc3e03 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/extension.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/extension.jvm.lux @@ -5,10 +5,10 @@ (data [maybe] text/format (coll (dictionary ["dict" unordered #+ Dict])))) - (//// [reference #+ Register Variable] - (host ["_" scheme #+ Computation]) - [compiler "operation/" Monad] - [synthesis #+ Synthesis]) + (///// [reference #+ Register Variable] + (host ["_" scheme #+ Computation]) + [compiler "operation/" Monad] + (compiler [synthesis #+ Synthesis])) [//runtime #+ Operation Translator] [/common] ## [/host] diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux index 644557bdc..dbb02da7f 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux @@ -13,9 +13,9 @@ (macro [code] ["s" syntax #+ syntax:]) [host]) - (///// (host ["_" scheme #+ Expression Computation]) - [compiler] - [synthesis #+ Synthesis]) + (////// (host ["_" scheme #+ Expression Computation]) + [compiler] + (compiler [synthesis #+ Synthesis])) [///runtime #+ Operation Translator]) ## [Types] diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/function.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/function.jvm.lux index 11c64076c..4ec601257 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/function.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/function.jvm.lux @@ -5,12 +5,12 @@ (data [product] text/format (coll [list "list/" Functor]))) - (//// [reference #+ Register Variable] - [name] - [compiler "operation/" Monad] - [analysis #+ Variant Tuple Environment Arity Abstraction Application Analysis] - [synthesis #+ Synthesis] - (host ["_" scheme #+ Expression Computation Var])) + (///// [reference #+ Register Variable] + [name] + (host ["_" scheme #+ Expression Computation Var]) + [compiler "operation/" Monad] + (compiler [analysis #+ Variant Tuple Environment Arity Abstraction Application Analysis] + [synthesis #+ Synthesis])) [///] [//runtime #+ Operation Translator] [//primitive] diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/loop.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/loop.jvm.lux index 6f305336e..e9ea1c3e8 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/loop.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/loop.jvm.lux @@ -1,39 +1,36 @@ (.module: - [lux #- loop] + [lux #- Scope] (lux (control [monad #+ do]) (data [product] [text] text/format (coll [list "list/" Functor])) [macro]) - [////] - (//// [name] - (host ["_" scheme #+ Computation Var]) - [compiler "operation/" Monad] - [synthesis #+ Synthesis]) + (///// (host ["_" scheme #+ Computation Var]) + [compiler] + (compiler [synthesis #+ Scope Synthesis])) [///] [//runtime #+ Operation Translator] [//reference]) -(def: @loop (_.var "loop")) +(def: @scope (_.var "scope")) -(def: #export (loop translate offset initsS+ bodyS) - (-> Translator Nat (List Synthesis) Synthesis - (Operation Computation)) +(def: #export (scope translate [start initsS+ bodyS]) + (-> Translator (Scope Synthesis) (Operation Computation)) (do compiler.Monad [initsO+ (monad.map @ translate initsS+) - bodyO (///.with-anchor @loop + bodyO (///.with-anchor @scope (translate bodyS))] - (wrap (_.letrec (list [@loop (_.lambda [(|> initsS+ - list.enumerate - (list/map (|>> product.left (n/+ offset) //reference.local'))) - #.None] - bodyO)]) - (_.apply/* @loop initsO+))))) + (wrap (_.letrec (list [@scope (_.lambda [(|> initsS+ + list.enumerate + (list/map (|>> product.left (n/+ start) //reference.local'))) + #.None] + bodyO)]) + (_.apply/* @scope initsO+))))) (def: #export (recur translate argsS+) (-> Translator (List Synthesis) (Operation Computation)) (do compiler.Monad - [@loop ///.anchor + [@scope ///.anchor argsO+ (monad.map @ translate argsS+)] - (wrap (_.apply/* @loop argsO+)))) + (wrap (_.apply/* @scope argsO+)))) diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/primitive.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/primitive.jvm.lux index ac775fa82..e78df5b74 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/primitive.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/primitive.jvm.lux @@ -1,8 +1,8 @@ (.module: [lux #- i64] [/// #+ State] - (//// [compiler #+ "operation/" Monad] - (host ["_" scheme #+ Expression])) + (///// [compiler #+ "operation/" Monad] + (host ["_" scheme #+ Expression])) [//runtime #+ Operation]) (def: #export bool diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/reference.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/reference.jvm.lux index 453d4edb6..e1cb6a642 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/reference.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/reference.jvm.lux @@ -2,12 +2,12 @@ lux (lux (control pipe) (data text/format)) - (//// [reference #+ Register Variable Reference] - [name] - [compiler "operation/" Monad] - [analysis #+ Variant Tuple] - [synthesis #+ Synthesis] - (host ["_" scheme #+ Expression Var])) + (///// [reference #+ Register Variable Reference] + [name] + (host ["_" scheme #+ Expression Var]) + [compiler "operation/" Monad] + (compiler [analysis #+ Variant Tuple] + [synthesis #+ Synthesis])) [//runtime #+ Operation Translator] [//primitive]) diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/runtime.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/runtime.jvm.lux index b30aff3a2..7ba873999 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/runtime.jvm.lux @@ -9,11 +9,11 @@ (macro [code] ["s" syntax #+ syntax:])) [/// #+ State] - (//// [name] - [compiler] - [analysis #+ Variant] - [synthesis] - (host ["_" scheme #+ Expression Computation Var]))) + (///// [name] + (host ["_" scheme #+ Expression Computation Var]) + [compiler] + (compiler [analysis #+ Variant] + [synthesis]))) (type: #export Operation (compiler.Operation (State Var Expression))) diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux index a11434594..c3b93e7a1 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux @@ -1,10 +1,10 @@ (.module: lux (lux (control [monad #+ do])) - (//// [compiler] - [analysis #+ Variant Tuple] - [synthesis #+ Synthesis] - (host ["_" scheme #+ Expression])) + (///// (host ["_" scheme #+ Expression]) + [compiler] + (compiler [analysis #+ Variant Tuple] + [synthesis #+ Synthesis])) [//runtime #+ Operation Translator] [//primitive]) diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux index bf9421cde..0f7b67b57 100644 --- a/stdlib/source/lux/macro/poly/functor.lux +++ b/stdlib/source/lux/macro/poly/functor.lux @@ -28,10 +28,10 @@ #let [@Functor (: (-> Type Code) (function (_ unwrappedT) (if (n/= +1 num-vars) - (` (functor.Functor (~ (poly.to-code *env* unwrappedT)))) + (` ((~! functor.Functor) (~ (poly.to-code *env* unwrappedT)))) (let [paramsC (|> num-vars dec list.indices (L/map (|>> %n code.local-symbol)))] (` (All [(~+ paramsC)] - (functor.Functor ((~ (poly.to-code *env* unwrappedT)) (~+ paramsC))))))))) + ((~! functor.Functor) ((~ (poly.to-code *env* unwrappedT)) (~+ paramsC))))))))) Arg (: (-> Code (poly.Poly Code)) (function (Arg valueC) ($_ p.either diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 775b86b69..fd85087d7 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -1,12 +1,12 @@ (.module: {#.doc "Codecs for values in the JSON format."} lux (lux (control [monad #+ do Monad] - [equivalence #+ Eq] + [equivalence #+ Equivalence] codec ["p" parser "p/" Monad]) (data [bool] [bit] - [text "text/" Eq] + [text "text/" Equivalence] (text ["l" lexer] format) [number "frac/" Codec "nat/" Codec] diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux index 567d7af42..35e681159 100644 --- a/stdlib/source/lux/type/quotient.lux +++ b/stdlib/source/lux/type/quotient.lux @@ -54,7 +54,7 @@ (do p.Monad [[valueT classT quotient-ex] (<| poly.apply (p.after (poly.this ..Class)) ($_ p.seq poly.any poly.any poly.existential))] - (wrap (.type (..Quotient valueT classT (~ (#.Ex quotient-ex)))))))) + (wrap (.type (..Quotient valueT classT (:~ (#.Ex quotient-ex)))))))) (syntax: #export (type {quotient s.symbol}) (do @ diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index 5072a677f..569c6f8c2 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -136,7 +136,7 @@ (def: #export (re-scale from to quantity) (All [si so u] (-> (Scale si) (Scale so) (Qty (si u)) (Qty (so u)))) - (let [[numerator denominator] (|> (:: to ratio) (r.r// (:: from ratio)))] + (let [[numerator denominator] (|> (:: to ratio) (r./ (:: from ratio)))] (|> quantity out (i/* (.int numerator)) -- cgit v1.2.3