aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool
diff options
context:
space:
mode:
authorEduardo Julian2020-07-16 23:19:57 -0400
committerEduardo Julian2020-07-16 23:19:57 -0400
commit80c727065593a4cadcb1d72c38c8ad5c3bf85acc (patch)
tree2f01222debb9a4756dfe3f26d41af660742487c9 /stdlib/source/lux/tool
parentde1d6adc6657feb81332db8620094dd8de150b96 (diff)
Can get the JS compiler to compile its own source-code.
Diffstat (limited to 'stdlib/source/lux/tool')
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux45
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux3
-rw-r--r--stdlib/source/lux/tool/compiler/meta/packager/script.lux33
3 files changed, 41 insertions, 40 deletions
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
index fa9307f90..b87e6b901 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
@@ -14,7 +14,7 @@
[collection
["." list ("#@." functor)]
["." dictionary]]]
- [target
+ ["@" target
["_" js (#+ Literal Expression Statement)]]]
["." //// #_
["/" bundle]
@@ -57,19 +57,36 @@
)
## [[Numbers]]
-(import: #long java/lang/Double
- (#static MIN_VALUE double)
- (#static MAX_VALUE double))
-
-(template [<name> <const>]
- [(def: (<name> _)
- (Nullary Expression)
- (//primitive.f64 <const>))]
-
- [f64//smallest (java/lang/Double::MIN_VALUE)]
- [f64//min (f.* -1.0 (java/lang/Double::MAX_VALUE))]
- [f64//max (java/lang/Double::MAX_VALUE)]
- )
+(for {@.old
+ (as-is (import: #long java/lang/Double
+ (#static MIN_VALUE double)
+ (#static MAX_VALUE double))
+
+ (template [<name> <const>]
+ [(def: (<name> _)
+ (Nullary Expression)
+ (//primitive.f64 <const>))]
+
+ [f64//smallest (java/lang/Double::MIN_VALUE)]
+ [f64//min (f.* -1.0 (java/lang/Double::MAX_VALUE))]
+ [f64//max (java/lang/Double::MAX_VALUE)]
+ ))
+
+ @.js
+ (as-is (import: Number
+ (#static MIN_VALUE Frac)
+ (#static MAX_VALUE Frac))
+
+ (template [<name> <const>]
+ [(def: (<name> _)
+ (Nullary Expression)
+ (//primitive.f64 <const>))]
+
+ [f64//smallest (Number::MIN_VALUE)]
+ [f64//min (f.* -1.0 (Number::MAX_VALUE))]
+ [f64//max (Number::MAX_VALUE)]
+ )
+ )})
(def: f64//decode
(Unary Expression)
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux
index 54f299c31..497261cf0 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux
@@ -20,7 +20,8 @@
["#." analysis (#+ Analysis)]
["/" synthesis (#+ Synthesis Phase)]
[///
- [reference (#+)]
+ [reference (#+)
+ [variable (#+)]]
["." phase ("#@." monad)]]]]])
(def: (primitive analysis)
diff --git a/stdlib/source/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/lux/tool/compiler/meta/packager/script.lux
index 88a7ddef0..bbbba4978 100644
--- a/stdlib/source/lux/tool/compiler/meta/packager/script.lux
+++ b/stdlib/source/lux/tool/compiler/meta/packager/script.lux
@@ -1,29 +1,20 @@
(.module:
- [lux (#- Module Definition)
+ [lux #*
[type (#+ :share)]
- ["." host (#+ import: do-to)]
[abstract
["." monad (#+ Monad do)]]
[control
["." try (#+ Try)]
- [concurrency
- ["." promise (#+ Promise)]]
[security
["!" capability]]]
[data
- ["." binary (#+ Binary)]
- ["." text
+ [binary (#+ Binary)]
+ [text
["%" format (#+ format)]
["." encoding]]
- [number
- ["n" nat]]
[collection
- ["." row (#+ Row)]
- ["." list ("#@." functor fold)]]]
- [target
- [jvm
- [encoding
- ["." name]]]]
+ ["." row]
+ ["." list ("#@." functor)]]]
[world
["." file (#+ File Directory)]]]
[program
@@ -32,7 +23,7 @@
["." // (#+ Packager)
[//
["." archive
- ["." descriptor (#+ Module)]
+ ["." descriptor]
["." artifact]]
[cache
["." dependency]]
@@ -41,11 +32,7 @@
[//
[language
["$" lux
- [generation (#+ Context)]
- [phase
- [generation
- [jvm
- ["." runtime (#+ Definition)]]]]]]]]])
+ [generation (#+ Context)]]]]]])
## TODO: Delete ASAP
(type: (Action ! a)
@@ -86,11 +73,7 @@
(Packager !)))
(function (package monad file-system static archive program)
(do {@ (try.with monad)}
- [cache (:share [!]
- {(Monad !)
- monad}
- {(! (Try (Directory !)))
- (:assume (!.use (:: file-system directory) [(get@ #static.target static)]))})
+ [cache (!.use (:: file-system directory) [(get@ #static.target static)])
order (:: monad wrap (dependency.load-order $.key archive))]
(|> order
(list@map (function (_ [module [module-id [descriptor document]]])