aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/lang
diff options
context:
space:
mode:
authorEduardo Julian2018-07-09 23:01:12 -0400
committerEduardo Julian2018-07-09 23:01:12 -0400
commit7c53a09d0ba1e443dd60dfdc4b8d8b134fcd120c (patch)
tree0d04f14d17d2147e6c8e7a22cbde0fb5662c6b60 /stdlib/source/lux/lang
parent68ad700b2e631f1ba4122fb3fba1a4285625a466 (diff)
- Fixes: Part 2.
Diffstat (limited to 'stdlib/source/lux/lang')
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux8
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/expression.jvm.lux31
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/extension.jvm.lux8
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux6
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/function.jvm.lux12
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/loop.jvm.lux35
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/primitive.jvm.lux4
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/reference.jvm.lux12
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/runtime.jvm.lux10
-rw-r--r--stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux8
10 files changed, 66 insertions, 68 deletions
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<List> Fold<List>]
(set ["set" unordered #+ Set]))))
- (//// [reference #+ Register]
- (host ["_" scheme #+ Expression Computation Var])
- [compiler #+ "operation/" Monad<Operation>]
- [synthesis #+ Synthesis Path])
+ (///// [reference #+ Register]
+ (host ["_" scheme #+ Expression Computation Var])
+ [compiler #+ "operation/" Monad<Operation>]
+ (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<Operation>
- [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<Operation>]
- [synthesis #+ Synthesis])
+ (///// [reference #+ Register Variable]
+ (host ["_" scheme #+ Computation])
+ [compiler "operation/" Monad<Operation>]
+ (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<List>])))
- (//// [reference #+ Register Variable]
- [name]
- [compiler "operation/" Monad<Operation>]
- [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<Operation>]
+ (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<List>]))
[macro])
- [////]
- (//// [name]
- (host ["_" scheme #+ Computation Var])
- [compiler "operation/" Monad<Operation>]
- [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<Operation>
[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<Operation>
- [@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<Operation>]
- (host ["_" scheme #+ Expression]))
+ (///// [compiler #+ "operation/" Monad<Operation>]
+ (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<Operation>]
- [analysis #+ Variant Tuple]
- [synthesis #+ Synthesis]
- (host ["_" scheme #+ Expression Var]))
+ (///// [reference #+ Register Variable Reference]
+ [name]
+ (host ["_" scheme #+ Expression Var])
+ [compiler "operation/" Monad<Operation>]
+ (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])