From 38c2eb5d39838e415a8c1f51b79099086b391a22 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 30 May 2021 19:33:34 -0400 Subject: Giving up on Kawa for now... --- lux-scheme/commands.md | 2 + lux-scheme/source/program.lux | 29 ++--- stdlib/source/lux/target/scheme.lux | 3 +- .../lux/phase/extension/analysis/scheme.lux | 7 +- .../lux/phase/extension/generation/scheme/host.lux | 1 + .../language/lux/phase/generation/reference.lux | 7 +- .../source/lux/tool/compiler/meta/io/archive.lux | 2 +- .../lux/tool/compiler/meta/packager/scheme.lux | 133 +++++++++++++++++++++ .../lux/tool/compiler/meta/packager/script.lux | 12 +- 9 files changed, 158 insertions(+), 38 deletions(-) create mode 100644 stdlib/source/lux/tool/compiler/meta/packager/scheme.lux diff --git a/lux-scheme/commands.md b/lux-scheme/commands.md index 7c915200c..11d6e2945 100644 --- a/lux-scheme/commands.md +++ b/lux-scheme/commands.md @@ -26,5 +26,7 @@ cd ~/lux/stdlib/ \ && time java -jar ~/lux/lux-scheme/target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux clear && time kawa ~/lux/stdlib/target/program.scm + +clear && time kawa ~/lux/stdlib/target/program/1.scm ``` diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux index 24d26945d..d71daa6e7 100644 --- a/lux-scheme/source/program.lux +++ b/lux-scheme/source/program.lux @@ -25,6 +25,8 @@ [number (#+ hex) ["n" nat] ["." i64]]] + [time + ["." instant]] ["." world #_ ["." file] ["#/." program]] @@ -57,7 +59,7 @@ ["." platform (#+ Platform)]] [meta ["." packager #_ - ["#" script]]]]]] + ["#" scheme]]]]]] [program ["/" compositor ["#." cli] @@ -442,24 +444,11 @@ (-> Any (Promise Any)) (promise.future (\ world/program.default exit +0))) -(def: (then pre post) - (-> _.Expression _.Expression _.Expression) - (_.manual (format (_.code pre) - text.new_line - (_.code post)))) - -(def: (scope body) - (-> _.Expression _.Expression) - (let [@program (_.var "lux_program")] - ($_ ..then - (_.define_function @program [(list) #.None] body) - (_.apply/* (list) @program) - ))) - (`` (program: [{service /cli.service}] (let [extension ".scm"] (do io.monad - [platform ..platform] + [platform ..platform + now instant.now] (exec (do promise.monad [_ (/.compiler {#/static.host @.scheme #/static.host_module_extension extension @@ -474,13 +463,9 @@ [_.Var _.Expression _.Expression] ..extender service - [(packager.package (_.manual "") - _.code - ..then - ..scope) + [(packager.package now) (format (/cli.target service) (\ file.default separator) - "program" - extension)])] + "program.tar")])] (..declare_success! [])) (io.io [])))))) diff --git a/stdlib/source/lux/target/scheme.lux b/stdlib/source/lux/target/scheme.lux index 408f1d9f1..651fca21d 100644 --- a/stdlib/source/lux/target/scheme.lux +++ b/stdlib/source/lux/target/scheme.lux @@ -224,7 +224,8 @@ [reverse/1 "reverse"] [display/1 "display"] [exit/1 "exit"] - [string-length/1 "string-length"]]] + [string-length/1 "string-length"] + [load-relative/1 "load-relative"]]] [apply/2 [_0 _1] [Expression Expression] [[append/2 "append"] diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux index ef13cb2ef..86db4170f 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux @@ -1,6 +1,6 @@ (.module: [lux #* - ["." host] + ["." ffi] [abstract ["." monad (#+ do)]] [control @@ -108,11 +108,11 @@ (def: Nil (for {@.scheme - host.Nil} + ffi.Nil} Any)) (def: Function - (for {@.scheme host.Function} + (for {@.scheme ffi.Function} Any)) (def: bundle::object @@ -153,4 +153,5 @@ (bundle.install "constant" scheme::constant) (bundle.install "apply" scheme::apply) + (bundle.install "script universe" (/.nullary .Bit)) ))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux index 55e46ad23..6072d29e5 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux @@ -104,4 +104,5 @@ (/.install "constant" scheme::constant) (/.install "apply" scheme::apply) + (/.install "script universe" (nullary (function.constant (_.bool reference.universe)))) ))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/reference.lux index bd1db66bf..9cca8b8e5 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/reference.lux @@ -22,7 +22,9 @@ ## Cannot make all definitions be local variables because of limitations with JRuby. @.ruby (not ("ruby script universe")) ## Cannot make all definitions be local variables because of limitations with PHP itself. - @.php (not ("php script universe"))} + @.php (not ("php script universe")) + ## Cannot make all definitions be local variables because of limitations with Kawa. + @.scheme (not ("scheme script universe"))} #0)) (def: universe_label @@ -30,7 +32,8 @@ (with_expansions [