diff options
72 files changed, 813 insertions, 785 deletions
diff --git a/documentation/bookmark/memory_management/reference_counting.md b/documentation/bookmark/memory_management/reference_counting.md index 024713c2f..2601bad95 100644 --- a/documentation/bookmark/memory_management/reference_counting.md +++ b/documentation/bookmark/memory_management/reference_counting.md @@ -1,6 +1,7 @@ # Reference 0. []() +0. [Reference Counting with Frame Limited Reuse (extended version, v2)](https://www.microsoft.com/en-us/research/publication/reference-counting-with-frame-limited-reuse-extended-version/) 0. [Implementing the Perceus reference counting GC](https://dev.to/raviqqe/implementing-the-perceus-reference-counting-gc-5662) 0. [Perceus: Garbage Free Reference Counting with Reuse (Extended version)](https://www.microsoft.com/en-us/research/publication/perceus-garbage-free-reference-counting-with-reuse/) 0. [StaticRc](https://github.com/matthieu-m/static-rc) diff --git a/documentation/bookmark/methodology.md b/documentation/bookmark/methodology.md deleted file mode 100644 index 63e770046..000000000 --- a/documentation/bookmark/methodology.md +++ /dev/null @@ -1,5 +0,0 @@ -# Reference - -1. [Managing developer identities in autonomous teams](https://kislayverma.com/organizations/managing-developer-identities-in-autonomous-teams/) -1. [Risk-First](https://riskfirst.org/) - diff --git a/documentation/bookmark/security/data.md b/documentation/bookmark/security/data.md new file mode 100644 index 000000000..d80f51f2d --- /dev/null +++ b/documentation/bookmark/security/data.md @@ -0,0 +1,5 @@ +# Reference + +0. []() +0. [Enarx: WebAssembly + Confidential Computing](https://enarx.dev/) + diff --git a/documentation/bookmark/software/methodology.md b/documentation/bookmark/software/methodology.md new file mode 100644 index 000000000..a5e2384a4 --- /dev/null +++ b/documentation/bookmark/software/methodology.md @@ -0,0 +1,7 @@ +# Reference + +0. []() +0. [Rugged Software](https://ruggedsoftware.org/) +0. [Managing developer identities in autonomous teams](https://kislayverma.com/organizations/managing-developer-identities-in-autonomous-teams/) +0. [Risk-First](https://riskfirst.org/) + diff --git a/documentation/bookmark/type_theory/union_and_intersection.md b/documentation/bookmark/type_theory/set.md index 3f053f60b..aa8abc587 100644 --- a/documentation/bookmark/type_theory/union_and_intersection.md +++ b/documentation/bookmark/type_theory/set.md @@ -1,5 +1,7 @@ # Reference +0. []() +0. [Programming with union, intersection, and negation types](https://arxiv.org/abs/2111.03354) 0. [Union and intersection contracts are hard, actually](https://www.tweag.io/blog/2022-04-28-union-intersection-contracts/) 0. [Union and intersection contracts are hard, actually](https://arxiv.org/abs/2106.06278) diff --git a/documentation/bookmark/web_framework.md b/documentation/bookmark/web_framework.md index 08b1aacd0..1163c8ee0 100644 --- a/documentation/bookmark/web_framework.md +++ b/documentation/bookmark/web_framework.md @@ -18,6 +18,7 @@ # Reference 0. []() +0. [Functional UI](https://take.surf/2022/07/04/functional-ui) 0. [UIs Are Not Pure Functions of the Model - React.js and Cocoa Side by Side](https://blog.metaobject.com/2018/12/uis-are-not-pure-functions-of-model.html) 0. [UIs are streaming DAGs](https://hyperfiddle.notion.site/UIs-are-streaming-DAGs-e181461681a8452bb9c7a9f10f507991) 0. [You Might Not Need an Effect](https://beta-reactjs-org-git-you-might-not-fbopensource.vercel.app/learn/you-might-not-need-an-effect) diff --git a/licentia/source/program/licentia.lux b/licentia/source/program/licentia.lux index d3218ec64..d4478b885 100644 --- a/licentia/source/program/licentia.lux +++ b/licentia/source/program/licentia.lux @@ -34,7 +34,7 @@ [format ["[0]" json (.only) ["<[1]>" \\parser (.only Parser)]]]] - ["[0]" program (.only program:) + ["[0]" program (.only program) ["<[1]>" \\parser]] [world ["[0]" file]]]] @@ -57,27 +57,28 @@ (format "Your license has been made!" text.new_line "Check the file " output ".")) -(program: [input (<| (<program>.named "--input") - <program>.any) - output (<| (parser.default ..default_output_file) - (<program>.named "--output") - <program>.any)] - (do io.monad - [?done (is (IO (Try Any)) - (do (try.with io.monad) - [blob (at file.default read input) - document (io#wrap (do [! try.monad] - [raw_json (at utf8.codec decoded blob) - json (|> raw_json - java/lang/String::trim - (at json.codec decoded))] - (|> json - (<json>.result /input.license) - (at ! each /output.license))))] - (at file.default write (at utf8.codec encoded document) output)))] - (wrap (debug.log! (case ?done - {try.#Success _} - (success_message output) +(def _ + (program [input (<| (<program>.named "--input") + <program>.any) + output (<| (parser.default ..default_output_file) + (<program>.named "--output") + <program>.any)] + (do io.monad + [?done (is (IO (Try Any)) + (do (try.with io.monad) + [blob (at file.default read input) + document (io#wrap (do [! try.monad] + [raw_json (at utf8.codec decoded blob) + json (|> raw_json + java/lang/String::trim + (at json.codec decoded))] + (|> json + (<json>.result /input.license) + (at ! each /output.license))))] + (at file.default write (at utf8.codec encoded document) output)))] + (wrap (debug.log! (case ?done + {try.#Success _} + (success_message output) - {try.#Failure message} - message))))) + {try.#Failure message} + message)))))) diff --git a/licentia/source/test/licentia.lux b/licentia/source/test/licentia.lux index 8d7bdc120..fe5829e74 100644 --- a/licentia/source/test/licentia.lux +++ b/licentia/source/test/licentia.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [program (.only program:)] + [program (.only program)] ["_" test (.only Test)] [abstract [monad (.only do)]] @@ -363,8 +363,9 @@ (present? notice.end_of_license)) ))) -(program: args - (<| io.io - _.run! - (_.times 100) - ..test)) +(def _ + (program args + (<| io.io + _.run! + (_.times 100) + ..test))) diff --git a/lux-bootstrapper/src/lux.clj b/lux-bootstrapper/src/lux.clj index 783a25a64..1d337df04 100644 --- a/lux-bootstrapper/src/lux.clj +++ b/lux-bootstrapper/src/lux.clj @@ -21,8 +21,10 @@ (defn -main [& args] (|case (&/->list args) - (&/$Item "release" (&/$Item program-module (&/$Item dependencies (&/$Item source-dirs (&/$Item target-dir (&/$End)))))) - (&compiler/compile-program &/$Build program-module + (&/$Item "release" (&/$Item program-module (&/$Item program-definition (&/$Item dependencies (&/$Item source-dirs (&/$Item target-dir (&/$End))))))) + (&compiler/compile-program &/$Build + program-module + program-definition (separate-paths dependencies) (separate-paths source-dirs) target-dir) diff --git a/lux-bootstrapper/src/lux/analyser.clj b/lux-bootstrapper/src/lux/analyser.clj index 7b6e009dd..286205e44 100644 --- a/lux-bootstrapper/src/lux/analyser.clj +++ b/lux-bootstrapper/src/lux/analyser.clj @@ -36,8 +36,7 @@ (|let [analyse (partial analyse-ast optimize eval! compile-module compilers) [location token] ?token compile-def (aget compilers 0) - compile-program (aget compilers 1) - macro-caller (aget compilers 2)] + macro-caller (aget compilers 1)] (|case token ;; Standard special forms (&/$Bit ?value) @@ -141,11 +140,6 @@ [_ (&/$Tuple ?slots)] (&&lux/analyse-def-type-tagged analyse optimize eval! compile-def ?name ?value true ?slots exported?)))) - "lux def program" - (|let [(&/$Item ?program (&/$End)) parameters] - (&/with-location location - (&&lux/analyse-program analyse optimize compile-program ?program))) - "lux def module" (|let [(&/$Item ?imports (&/$End)) parameters] (&/with-location location diff --git a/lux-bootstrapper/src/lux/analyser/lux.clj b/lux-bootstrapper/src/lux/analyser/lux.clj index 23f6cf4fa..07ef7e07f 100644 --- a/lux-bootstrapper/src/lux/analyser/lux.clj +++ b/lux-bootstrapper/src/lux/analyser/lux.clj @@ -737,11 +737,3 @@ _ (&type/check exo-type ==type) =value (&&/analyse-1+ analyse ?value)] (return (&/|list (coerce ==type =value))))) - -(let [program-type (&/$Function (&/$Apply &type/Text &type/List) - (&/$Apply &type/Any &type/IO))] - (defn analyse-program [analyse optimize compile-program ?program] - (|do [_ &/ensure-declaration - =program (&&/analyse-1 analyse program-type ?program) - _ (compile-program (optimize =program))] - (return &/$End)))) diff --git a/lux-bootstrapper/src/lux/analyser/proc/jvm.clj b/lux-bootstrapper/src/lux/analyser/proc/jvm.clj index 0cfa8c873..9dba428d5 100644 --- a/lux-bootstrapper/src/lux/analyser/proc/jvm.clj +++ b/lux-bootstrapper/src/lux/analyser/proc/jvm.clj @@ -932,7 +932,7 @@ )))) (defn analyse-host [analyse exo-type compilers proc ?values] - (|let [[_ _ _ compile-class compile-interface] compilers] + (|let [[_ _ compile-class compile-interface] compilers] (try (case proc "jvm object synchronized" (analyse-jvm-object-synchronized analyse exo-type ?values) "jvm object class" (analyse-jvm-object-class analyse exo-type ?values) diff --git a/lux-bootstrapper/src/lux/compiler.clj b/lux-bootstrapper/src/lux/compiler.clj index a3e60e463..671f7e82b 100644 --- a/lux-bootstrapper/src/lux/compiler.clj +++ b/lux-bootstrapper/src/lux/compiler.clj @@ -24,6 +24,6 @@ (defn compile-module [source-dirs name] (&&jvm/compile-module source-dirs name)) -(defn compile-program [mode program-module dependencies source-dirs target-dir] +(defn compile-program [mode program-module program-definition dependencies source-dirs target-dir] (init! dependencies target-dir) - (&&jvm/compile-program mode program-module source-dirs)) + (&&jvm/compile-program mode program-module program-definition source-dirs)) diff --git a/lux-bootstrapper/src/lux/compiler/jvm.clj b/lux-bootstrapper/src/lux/compiler/jvm.clj index ebef7c418..1baec30e1 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm.clj @@ -154,12 +154,10 @@ return)))) (def all-compilers - (let [compile-expression* (partial compile-expression nil)] - (&/T [(partial &&lux/compile-def compile-expression) - (partial &&lux/compile-program compile-expression*) - (fn [macro args state] (.apply macro args state)) - (partial &&proc-host/compile-jvm-class compile-expression*) - &&proc-host/compile-jvm-interface]))) + (&/T [(partial &&lux/compile-def compile-expression) + (fn [macro args state] (.apply macro args state)) + (partial &&proc-host/compile-jvm-class (partial compile-expression nil)) + &&proc-host/compile-jvm-interface])) (defn ^:private activate-module! [name file-hash] (|do [_ (&&cache/delete name) @@ -174,10 +172,10 @@ (let [+field-flags+ (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL Opcodes/ACC_STATIC) +datum-sig+ "Ljava/lang/Object;"] - (defn compile-module [source-dirs name] + (defn compile-module [source-dirs name next] (|do [[file-name file-content] (&&io/read-file source-dirs name) :let [file-hash (hash file-content) - compile-module!! (&¶llel/parallel-compilation (partial compile-module source-dirs))]] + compile-module!! (&¶llel/parallel-compilation (fn [sub_module] (compile-module source-dirs sub_module nil)))]] (&/|eitherL (&&cache/load name) (|do [module-exists? (&a-module/exists? name)] (if module-exists? @@ -199,7 +197,11 @@ (&/exhaust% compiler-step)) (&/set$ &/$source (&reader/from name file-content) state)) (&/$Right ?state _) - (&/run-state (|do [:let [_ (.visitEnd =class)] + (&/run-state (|do [_ (if next + (&/with-writer =class + next) + (return nil)) + :let [_ (.visitEnd =class)] _ (save-module! name file-hash (.toByteArray =class)) :let [_ (println 'MODULE name)]] (return file-hash)) @@ -237,14 +239,24 @@ (&/|table) ])))) +(def program-type + (&/$Function (&/$Apply &type/Text &type/List) + (&/$Apply &type/Any &type/IO))) + (let [!err! *err*] - (defn compile-program [mode program-module source-dirs] + (defn compile-program [mode program-module program-definition source-dirs] (let [m-action (|do [_ (&&cache/pre-load-cache! source-dirs &&jvm-cache/load-def-value &&jvm-cache/install-all-defs-in-module &&jvm-cache/uninstall-all-defs-in-module) - _ (compile-module source-dirs &/prelude)] - (compile-module source-dirs program-module))] + _ (compile-module source-dirs &/prelude nil)] + (compile-module source-dirs program-module + (|do [[de_aliased_symbol [exported? actual-type ?value]] (&a-module/find-def program-module program-definition) + _ (&type/check program-type actual-type) + here &/location] + (&&lux/compile-program (partial compile-expression nil) + (&a/|meta program-type here + (&o/$def de_aliased_symbol))))))] (|case (m-action (&/init-state "{old}" mode (jvm-host))) (&/$Right ?state _) (do (println "Compilation complete!") diff --git a/lux-cl/source/program.lux b/lux-cl/source/program.lux index c5d76c436..2121d401a 100644 --- a/lux-cl/source/program.lux +++ b/lux-cl/source/program.lux @@ -1,6 +1,6 @@ (.require [lux (.except) - [program (.only program:)] + [program (.only program)] ["[0]" ffi] ["[0]" debug] [abstract @@ -412,31 +412,32 @@ (_.call/* @program (list)) ))) -(`` (program: [service /cli.service] - (let [extension ".cl"] - (do io.monad - [platform ..platform] - (exec (do promise.monad - [_ (/.compiler [/static.#host @.common_lisp - /static.#host_module_extension extension - /static.#target (/cli.target service) - /static.#artifact_extension extension] - ..expander - analysis.bundle - (io.io platform) - generation.bundle - extension/bundle.empty - ..program - [(And _.Tag Register) (type_literal (_.Expression Any)) (type_literal (_.Expression Any))] - ..extender - service - [(packager.package (_.manual "") - _.code - ..then - ..scope) - (format (/cli.target service) - (at file.default separator) - "program" - extension)])] - (..declare_success! [])) - (io.io [])))))) +(`` (def _ + (program [service /cli.service] + (let [extension ".cl"] + (do io.monad + [platform ..platform] + (exec (do promise.monad + [_ (/.compiler [/static.#host @.common_lisp + /static.#host_module_extension extension + /static.#target (/cli.target service) + /static.#artifact_extension extension] + ..expander + analysis.bundle + (io.io platform) + generation.bundle + extension/bundle.empty + ..program + [(And _.Tag Register) (type_literal (_.Expression Any)) (type_literal (_.Expression Any))] + ..extender + service + [(packager.package (_.manual "") + _.code + ..then + ..scope) + (format (/cli.target service) + (at file.default separator) + "program" + extension)])] + (..declare_success! [])) + (io.io []))))))) diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 1df4d4803..c692a41a0 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [program (.only program:)] + [program (.only program)] ["[0]" ffi (.only import)] ["[0]" debug] [abstract @@ -707,26 +707,27 @@ (-> Any platform.Custom) (undefined)) -(program: [service cli.service] - (let [context (context.js (cli.target service))] - (exec - (do async.monad - [platform (async.future ..platform) - _ (/.compiler ..lux_compiler - context - ..expander - analysis.bundle - (io.io platform) - generation.bundle - (function.constant extension/bundle.empty) - ..program - [(And Register Text) _.Expression _.Statement] - ..extender - service - [(packager.package _.use_strict _.code _.then ..scope) - (format (cli.target service) - (at (the platform.#file_system platform) separator) - "program" - (the context.#artifact_extension context))])] - (..declare_success! [])) - (io.io [])))) +(def _ + (program [service cli.service] + (let [context (context.js (cli.target service))] + (exec + (do async.monad + [platform (async.future ..platform) + _ (/.compiler ..lux_compiler + context + ..expander + analysis.bundle + (io.io platform) + generation.bundle + (function.constant extension/bundle.empty) + ..program + [(And Register Text) _.Expression _.Statement] + ..extender + service + [(packager.package _.use_strict _.code _.then ..scope) + (format (cli.target service) + (at (the platform.#file_system platform) separator) + "program" + (the context.#artifact_extension context))])] + (..declare_success! [])) + (io.io []))))) diff --git a/lux-jvm/project.clj b/lux-jvm/project.clj index fa6ce9dff..38e56ffdb 100644 --- a/lux-jvm/project.clj +++ b/lux-jvm/project.clj @@ -26,6 +26,6 @@ :manifest {"lux" ~version} :source-paths ["source"] - :lux {:program "program" - :test "test/program"} + :lux {:program ["program" "_"] + :test ["test/program" "_"]} ) diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux index 217218e2e..17fe054ef 100644 --- a/lux-jvm/source/program.lux +++ b/lux-jvm/source/program.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except Definition) - [program (.only program:)] + [program (.only program)] ["[0]" ffi (.only import)] [abstract [monad (.only do)]] @@ -49,7 +49,8 @@ ["/" jvm (.only) ["[1][0]" runtime (.only Anchor Definition)] ["[1][0]" host] - ["[1][0]" program]]]]]]]] + ["[1][0]" program] + ["[1][0]" reference]]]]]]]] ["[0]" world ["[0]" file] ["[1]/[0]" environment]]]] @@ -159,27 +160,28 @@ (-> Any (Async Any)) (async.future (at world/environment.default exit +0))) -(def (lux_compiler it) +(def lux_compiler (-> Any platform.Custom) - (as_expected it)) - -(program: [service cli.service] - (let [context (context.jvm (cli.target service))] - (exec (do async.monad - [[loader host platform] (async.future ..platform) - _ (compositor.compiler - ..lux_compiler - context - ..expander - (analysis.bundle loader host) - (io.io platform) - generation.bundle - (|>> ..extender (declaration.bundle loader)) - (/program.program /runtime.class_name) - [Anchor (type_literal (Bytecode Any)) Definition] - ..extender - service - [(packager.package context) - (format (cli.target service) (at file.default separator) "program.jar")])] - (..declare_success! [])) - (io.io [])))) + (|>> as_expected)) + +(def _ + (program [service cli.service] + (let [context (context.jvm (cli.target service))] + (exec (do async.monad + [[loader host platform] (async.future ..platform) + _ (compositor.compiler + ..lux_compiler + context + ..expander + (analysis.bundle loader host) + (io.io platform) + generation.bundle + (|>> ..extender (declaration.bundle loader)) + (/program.program /runtime.class_name) /reference.constant + [Anchor (type_literal (Bytecode Any)) Definition] + ..extender + service + [(packager.package context) + (format (cli.target service) (at file.default separator) "program.jar")])] + (..declare_success! [])) + (io.io []))))) diff --git a/lux-lein/project.clj b/lux-lein/project.clj index d9c1cabc2..9ab37a5f2 100644 --- a/lux-lein/project.clj +++ b/lux-lein/project.clj @@ -1,4 +1,6 @@ -(defproject com.github.luxlang/lein-luxc "0.6.5" +(def version "0.6.6-SNAPSHOT") + +(defproject com.github.luxlang/lein-luxc #=(identity version) :description "The Leiningen plugin for the Lux programming language." :url "https://github.com/LuxLang/lux" :license {:name "Lux License v0.1.2" diff --git a/lux-lein/src/leiningen/lux/builder.clj b/lux-lein/src/leiningen/lux/builder.clj index 408af5c7b..e25d1818f 100644 --- a/lux-lein/src/leiningen/lux/builder.clj +++ b/lux-lein/src/leiningen/lux/builder.clj @@ -4,15 +4,8 @@ [packager :as &packager]))) (defn build [project] - (if-let [program-module (get-in project [:lux :program])] - ;; (if-let [command (&utils/build-jvm project program-module)] - ;; (when (time (&utils/run-process command - ;; nil - ;; "[COMPILATION BEGAN]" - ;; "[COMPILATION ENDED]")) - ;; true) - ;; ) - (let [command (&utils/compile-path project program-module (get project :source-paths (list)))] + (if-let [[program-module program-definition] (get-in project [:lux :program])] + (let [command (&utils/compile-path project program-module program-definition (get project :source-paths (list)))] (when (time (&utils/run-process command nil "[COMPILATION BEGAN]" diff --git a/lux-lein/src/leiningen/lux/test.clj b/lux-lein/src/leiningen/lux/test.clj index 84ba33d58..a51a2c3bc 100644 --- a/lux-lein/src/leiningen/lux/test.clj +++ b/lux-lein/src/leiningen/lux/test.clj @@ -7,8 +7,8 @@ (def missing-module-error "Please provide a test module in [:lux :test]") (defn test [project] - (if-let [test-module (get-in project [:lux :test])] - (when (time (&utils/run-process (&utils/compile-path project test-module (concat (:test-paths project) (:source-paths project))) + (if-let [[test-module test-definition] (get-in project [:lux :test])] + (when (time (&utils/run-process (&utils/compile-path project test-module test-definition (concat (:test-paths project) (:source-paths project))) nil "[COMPILATION BEGAN]" "[COMPILATION ENDED]")) diff --git a/lux-lein/src/leiningen/lux/utils.clj b/lux-lein/src/leiningen/lux/utils.clj index f18da2831..abcd907c6 100644 --- a/lux-lein/src/leiningen/lux/utils.clj +++ b/lux-lein/src/leiningen/lux/utils.clj @@ -87,7 +87,7 @@ " " (get project :target-path default-target-dir))) (do-template [<name> <mode>] - (defn <name> [project module source-paths] + (defn <name> [project module definition source-paths] (let [is-stdlib? (= stdlib-id (project-id project)) raw-paths (project-jars project) @@ -128,7 +128,7 @@ " -cp " (str compiler-class-path java.io.File/pathSeparator program-class-path) " " (lux-command project <mode> program-dependencies source-paths)))) - compile-path (str "release " module) + compile-path (str "release " module " " definition) repl-path "repl" ) diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux index 824b2b33b..150feec52 100644 --- a/lux-lua/source/program.lux +++ b/lux-lua/source/program.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [program (.only program:)] + [program (.only program)] ["[0]" ffi] [abstract ["[0]" monad (.only do)]] @@ -881,38 +881,39 @@ (-> Any platform.Custom) (undefined)) -(`` (program: [service cli.service] - (let [context (context.lua (cli.target service))] - (do io.monad - [(,, (for @.old [baggage platform] - @.jvm [baggage platform] - @.lua platform)) - ..platform] - (exec (do async.monad - [_ (/.compiler ..lux_compiler - context - (for @.old (..expander ..to_host baggage) - @.jvm (..expander ..to_host baggage) - @.lua ..expander) - analysis.bundle - (io.io platform) - generation.bundle - (function.constant extension/bundle.empty) - ..program - [(type_literal [Register _.Label]) - _.Expression - _.Statement] - (for @.old (..extender baggage) - @.jvm (..extender baggage) - @.lua ..extender) - service - [(packager.package (_.manual "") - _.code - _.then - (|>>)) - (format (cli.target service) - (at file.default separator) - "program" - (the context.#artifact_extension context))])] - (..declare_success! [])) - (io.io [])))))) +(`` (def _ + (program [service cli.service] + (let [context (context.lua (cli.target service))] + (do io.monad + [(,, (for @.old [baggage platform] + @.jvm [baggage platform] + @.lua platform)) + ..platform] + (exec (do async.monad + [_ (/.compiler ..lux_compiler + context + (for @.old (..expander ..to_host baggage) + @.jvm (..expander ..to_host baggage) + @.lua ..expander) + analysis.bundle + (io.io platform) + generation.bundle + (function.constant extension/bundle.empty) + ..program + [(type_literal [Register _.Label]) + _.Expression + _.Statement] + (for @.old (..extender baggage) + @.jvm (..extender baggage) + @.lua ..extender) + service + [(packager.package (_.manual "") + _.code + _.then + (|>>)) + (format (cli.target service) + (at file.default separator) + "program" + (the context.#artifact_extension context))])] + (..declare_success! [])) + (io.io []))))))) diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index c2c3294d0..90ced20ed 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -392,12 +392,12 @@ Called by `imenu--generic-function'." (alternative-format (altRE "char" "bin" "oct" "hex")) (documentation (altRE "comment")) (function-application (altRE "|>" "<|" "left" "right" "all")) - (function-definition (altRE "function" "|>>" "<<|")) + (function-definition (altRE "function" "|>>" "<<|" + "program")) (remember (altRE "remember" "to_do" "fix_me")) (extension (altRE "analysis" "synthesis" "generation" "declaration")) (definition (altRE "\\.require" - "def" "inlined" "type" "program:" - "macro" "syntax" + "def" "inlined" "type" "exception"))) (let ((control (altRE control//flow control//pattern-matching @@ -495,7 +495,6 @@ highlighted region)." (font-lock-syntactic-face-function . lux-font-lock-syntactic-face-function)))) (defvar withRE (concat "\\`" "with" (altRE "_" "\\'"))) -(defvar definitionRE ":\\'") (defun lux-indent-function (indent-point state) "When indenting a line within a function call, indent properly. @@ -553,8 +552,7 @@ This function also returns nil meaning don't specify the indentation." ((or (eq method 'defun) (and (null method) (> (length function) 2) - (or (string-match withRE function-tail) - (string-match definitionRE function-tail)))) + (string-match withRE function-tail))) (lisp-indent-defform state indent-point)) ((integerp method) (lisp-indent-specform method state @@ -582,6 +580,7 @@ This function also returns nil meaning don't specify the indentation." ("syntax" 'defun) ("template" 'defun) ("polytypic" 'defun) + ("program" 'defun) ("def" 'defun) ("type" 'defun) diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux index dbaded2ce..d3d191a8f 100644 --- a/lux-php/source/program.lux +++ b/lux-php/source/program.lux @@ -1,6 +1,6 @@ (.require [lux (.except) - [program (.only program:)] + [program (.only program)] ["[0]" ffi] ["[0]" debug] [abstract @@ -558,31 +558,32 @@ (-> Any (Promise Any)) (promise.future (at world/program.default exit +0))) -(`` (program: [service /cli.service] - (let [extension ".php"] - (do io.monad - [platform ..platform] - (exec (do promise.monad - [_ (/.compiler [/static.#host @.php - /static.#host_module_extension extension - /static.#target (/cli.target service) - /static.#artifact_extension extension] - ..expander - analysis.bundle - (io.io platform) - generation.bundle - extension/bundle.empty - ..program - [(& Nat _.Label) _.Expression _.Statement] - ..extender - service - [(packager.package (_.manual "<?php") - _.code - _.then - (|>>)) - (format (/cli.target service) - (at file.default separator) - "program" - extension)])] - (..declare_success! [])) - (io.io [])))))) +(`` (def _ + (program [service /cli.service] + (let [extension ".php"] + (do io.monad + [platform ..platform] + (exec (do promise.monad + [_ (/.compiler [/static.#host @.php + /static.#host_module_extension extension + /static.#target (/cli.target service) + /static.#artifact_extension extension] + ..expander + analysis.bundle + (io.io platform) + generation.bundle + extension/bundle.empty + ..program + [(& Nat _.Label) _.Expression _.Statement] + ..extender + service + [(packager.package (_.manual "<?php") + _.code + _.then + (|>>)) + (format (/cli.target service) + (at file.default separator) + "program" + extension)])] + (..declare_success! [])) + (io.io []))))))) diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index a14949e61..cf4398f89 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [program (.only program:)] + [program (.only program)] ["[0]" ffi (.only import)] ["[0]" debug] [abstract @@ -576,30 +576,31 @@ (-> Any platform.Custom) (undefined)) -(program: [service cli.service] - (let [extension ".py"] - (exec - (do async.monad - [_ (/.compiler ..lux_compiler - (context.python (cli.target service)) - ..expander - analysis.bundle - ..platform - generation.bundle - (function.constant extension/bundle.empty) - ..program - [Register - (type_literal (_.Expression Any)) - (type_literal (_.Statement Any))] - ..extender - service - [(packager.package (is (_.Statement Any) (_.manual "")) - _.code - _.then - ..scope) - (format (cli.target service) - (at file.default separator) - "program" - extension)])] - (..declare_success! [])) - (io.io [])))) +(def _ + (program [service cli.service] + (let [extension ".py"] + (exec + (do async.monad + [_ (/.compiler ..lux_compiler + (context.python (cli.target service)) + ..expander + analysis.bundle + ..platform + generation.bundle + (function.constant extension/bundle.empty) + ..program + [Register + (type_literal (_.Expression Any)) + (type_literal (_.Statement Any))] + ..extender + service + [(packager.package (is (_.Statement Any) (_.manual "")) + _.code + _.then + ..scope) + (format (cli.target service) + (at file.default separator) + "program" + extension)])] + (..declare_success! [])) + (io.io []))))) diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux index 7cb8645f7..42d095a41 100644 --- a/lux-r/source/program.lux +++ b/lux-r/source/program.lux @@ -1,6 +1,6 @@ (.require [lux (.except) - [program (.only program:)] + [program (.only program)] ["[0]" ffi] ["[0]" debug] [abstract @@ -596,31 +596,32 @@ (_.apply/0 $program []) ))) -(`` (program: [service /cli.service] - (let [extension ".r"] - (do io.monad - [[interpreter platform] ..platform] - (exec (do promise.monad - [_ (/.compiler [/static.#host @.r - /static.#host_module_extension extension - /static.#target (/cli.target service) - /static.#artifact_extension extension] - (..expander interpreter) - analysis.bundle - (io.io platform) - generation.bundle - extension/bundle.empty - ..program - [_.SVar _.Expression _.Expression] - ..extender - service - [(packager.package (_.manual "") - _.code - _.then - ..scope) - (format (/cli.target service) - (at file.default separator) - "program" - extension)])] - (..declare_success! [])) - (io.io [])))))) +(`` (def _ + (program [service /cli.service] + (let [extension ".r"] + (do io.monad + [[interpreter platform] ..platform] + (exec (do promise.monad + [_ (/.compiler [/static.#host @.r + /static.#host_module_extension extension + /static.#target (/cli.target service) + /static.#artifact_extension extension] + (..expander interpreter) + analysis.bundle + (io.io platform) + generation.bundle + extension/bundle.empty + ..program + [_.SVar _.Expression _.Expression] + ..extender + service + [(packager.package (_.manual "") + _.code + _.then + ..scope) + (format (/cli.target service) + (at file.default separator) + "program" + extension)])] + (..declare_success! [])) + (io.io []))))))) diff --git a/lux-r/source/test/program.lux b/lux-r/source/test/program.lux index f487dd0cf..dd0db1990 100644 --- a/lux-r/source/test/program.lux +++ b/lux-r/source/test/program.lux @@ -4,15 +4,16 @@ [control ["[0]" io] [parser - [cli (.only program:)]]]] + [cli (.only program)]]]] [spec ["[0]" compositor]] [\\ ["[0]" /]]) -(program: args - (<| io.io - _.run! - ... (_.times 100) - (_.seed 1985013625126912890) - (compositor.spec /.jvm /.bundle /.expander /.program))) +(def _ + (program args + (<| io.io + _.run! + ... (_.times 100) + (_.seed 1985013625126912890) + (compositor.spec /.jvm /.bundle /.expander /.program)))) diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 35aada877..df8ed9b66 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [program (.only program:)] + [program (.only program)] ["[0]" debug] ["[0]" ffi (.only import)] [abstract @@ -987,23 +987,24 @@ (-> Any platform.Custom) (undefined)) -(program: [service cli.service] - (exec - (do async.monad - [_ (/.compiler ..lux_compiler - (context.ruby (cli.target service)) - ..expander - analysis.bundle - ..platform - generation.bundle - (function.constant extension/bundle.empty) - ..program - [Register _.Expression _.Statement] - ..extender - service - [packager.package - (format (cli.target service) - (at file.default separator) - "program")])] - (..declare_success! [])) - (io.io []))) +(def _ + (program [service cli.service] + (exec + (do async.monad + [_ (/.compiler ..lux_compiler + (context.ruby (cli.target service)) + ..expander + analysis.bundle + ..platform + generation.bundle + (function.constant extension/bundle.empty) + ..program + [Register _.Expression _.Statement] + ..extender + service + [packager.package + (format (cli.target service) + (at file.default separator) + "program")])] + (..declare_success! [])) + (io.io [])))) diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux index d4744ba40..b6d06f341 100644 --- a/lux-scheme/source/program.lux +++ b/lux-scheme/source/program.lux @@ -1,6 +1,6 @@ (.require [lux (.except) - [program (.only program:)] + [program (.only program)] ["[0]" ffi] ["[0]" debug] [abstract @@ -454,28 +454,29 @@ (-> Any (Promise Any)) (promise.future (at world/program.default exit +0))) -(`` (program: [service /cli.service] - (let [extension ".scm"] - (do io.monad - [platform ..platform - now instant.now] - (exec (do promise.monad - [_ (/.compiler [/static.#host @.scheme - /static.#host_module_extension extension - /static.#target (/cli.target service) - /static.#artifact_extension extension] - ..expander - analysis.bundle - (io.io platform) - generation.bundle - extension/bundle.empty - ..program - [_.Var _.Expression _.Expression] - ..extender - service - [(packager.package now) - (format (/cli.target service) - (at file.default separator) - "program.tar")])] - (..declare_success! [])) - (io.io [])))))) +(`` (def _ + (program [service /cli.service] + (let [extension ".scm"] + (do io.monad + [platform ..platform + now instant.now] + (exec (do promise.monad + [_ (/.compiler [/static.#host @.scheme + /static.#host_module_extension extension + /static.#target (/cli.target service) + /static.#artifact_extension extension] + ..expander + analysis.bundle + (io.io platform) + generation.bundle + extension/bundle.empty + ..program + [_.Var _.Expression _.Expression] + ..extender + service + [(packager.package now) + (format (/cli.target service) + (at file.default separator) + "program.tar")])] + (..declare_success! [])) + (io.io []))))))) diff --git a/stdlib/project.clj b/stdlib/project.clj index c7f49706f..dfffbef5a 100644 --- a/stdlib/project.clj +++ b/stdlib/project.clj @@ -1,4 +1,4 @@ -(def version "0.6.5") +(def version "0.6.6-SNAPSHOT") (def repo "https://github.com/LuxLang/lux") (def sonatype-releases "https://oss.sonatype.org/service/local/staging/deploy/maven2/") (def sonatype-snapshots "https://oss.sonatype.org/content/repositories/snapshots/") @@ -24,6 +24,6 @@ :dependencies [[com.github.luxlang/lux-bootstrapper ~version]] :profiles {:bibliotheca {:lux {:test "test/lux"}} :aedifex {:description "A build system/tool made exclusively for Lux." - :lux {:program "program/aedifex" - :test "test/aedifex"}}} + :lux {:program ["program/aedifex" "_"] + :test ["test/aedifex" "_"]}}} ) diff --git a/stdlib/project.lux b/stdlib/project.lux index 67ffc7c6b..b0275ebd8 100644 --- a/stdlib/project.lux +++ b/stdlib/project.lux @@ -82,12 +82,12 @@ ] "bibliotheca" - ["test" "test/lux"] + ["test" test/lux._] "scriptum" ["info" ["description" "Documentation for the Standard Library for the Lux programming language."] - "program" "documentation/lux" - "test" "documentation/lux"] + "program" documentation/lux._ + "test" documentation/lux._] "aedifex" ["info" ["description" "A build system/tool made exclusively for Lux."] @@ -95,6 +95,6 @@ ... Specifying them here is like automatically using Aedifex's "with" command. "parents" ["jvm"] ... The name of the main module of the program. - "program" "program/aedifex" + "program" program/aedifex._ ... The name of the main module where the tests are located. - "test" "test/aedifex"]] + "test" test/aedifex._]] diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 086a7212f..947fec8a1 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -1,7 +1,7 @@ (.require [library [lux - [program (.only program:)] + [program (.only program)] ["$" documentation] ["[0]" debug] [control @@ -893,5 +893,6 @@ /test.documentation /world.documentation]))) -(program: inputs - (io.io (debug.log! ($.markdown ..documentation)))) +(def _ + (program inputs + (io.io (debug.log! ($.markdown ..documentation))))) diff --git a/stdlib/source/documentation/lux/program.lux b/stdlib/source/documentation/lux/program.lux index 60f433db2..bc126a34a 100644 --- a/stdlib/source/documentation/lux/program.lux +++ b/stdlib/source/documentation/lux/program.lux @@ -53,16 +53,18 @@ (.List $.Module) ($.module /._ "" - [($.definition /.program: + [($.definition /.program "Defines the entry-point to a program (similar to the 'main' function/method in other programming languages)." ["Can take a list of all the input parameters to the program." - (program: all_arguments - (do io.monad - [foo (initialize program)] - (do_something_with all_arguments)))] + (def _ + (program all_arguments + (do io.monad + [foo (initialize program)] + (do_something_with all_arguments))))] ["Can also parse them using CLI parsers from the library/lux/control/parser/cli module." - (program: [config configuration_parser] - (do io.monad - [data (initialize program with config)] - (do_something_with data)))])] + (def _ + (program [config configuration_parser] + (do io.monad + [data (initialize program with config)] + (do_something_with data))))])] [..\\parser])) diff --git a/stdlib/source/documentation/lux/test.lux b/stdlib/source/documentation/lux/test.lux index c66aa8eac..467b04150 100644 --- a/stdlib/source/documentation/lux/test.lux +++ b/stdlib/source/documentation/lux/test.lux @@ -67,7 +67,7 @@ ($.definition /.run! (format "Executes a test, and exits the program with either a successful or a failing exit code." - \n "WARNING: This procedure is only meant to be used in (program: ...) forms.") + \n "WARNING: This procedure is only meant to be used in (program ...) forms.") [(run! test)]) ($.definition /.coverage' diff --git a/stdlib/source/documentation/lux/world.lux b/stdlib/source/documentation/lux/world.lux index 795612a5e..2e3dd6945 100644 --- a/stdlib/source/documentation/lux/world.lux +++ b/stdlib/source/documentation/lux/world.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - [program (.only program:)] ["$" documentation] ["[0]" debug] [control diff --git a/stdlib/source/documentation/lux/world/net.lux b/stdlib/source/documentation/lux/world/net.lux index 1bc599540..6ec146ddf 100644 --- a/stdlib/source/documentation/lux/world/net.lux +++ b/stdlib/source/documentation/lux/world/net.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - [program (.only program:)] ["$" documentation] ["[0]" debug] [control diff --git a/stdlib/source/documentation/lux/world/net/uri.lux b/stdlib/source/documentation/lux/world/net/uri.lux index ab808ab5f..525dacf19 100644 --- a/stdlib/source/documentation/lux/world/net/uri.lux +++ b/stdlib/source/documentation/lux/world/net/uri.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - [program (.only program:)] ["$" documentation] ["[0]" debug] [control diff --git a/stdlib/source/library/lux/meta/compiler/default/init.lux b/stdlib/source/library/lux/meta/compiler/default/init.lux index 6d6704655..019edf1c5 100644 --- a/stdlib/source/library/lux/meta/compiler/default/init.lux +++ b/stdlib/source/library/lux/meta/compiler/default/init.lux @@ -27,7 +27,7 @@ ["[1][0]" phase] [language [lux - [program (.only Program)] + ["[1][0]" program (.only Program)] ["[1][0]" syntax (.only Aliases)] ["[1][0]" synthesis] ["[1][0]" declaration (.only Requirements)] @@ -47,6 +47,7 @@ ["[0]D" lux]]]]]] [meta ["[0]" archive (.only Archive) + ["[0]" unit] ["[0]" registry (.only Registry)] ["[0]" module (.only) ["[0]" descriptor] @@ -230,62 +231,93 @@ (-> .Module Aliases) (|>> (the .#module_aliases) (dictionary.of_list text.hash))) -(def .public (compiler wrapper expander prelude write_declaration) - (All (_ anchor expression declaration) - (-> ///phase.Wrapper Expander descriptor.Module (-> declaration Binary) - (Instancer (///declaration.State+ anchor expression declaration) .Module))) - (let [execute! (declarationP.phase wrapper expander)] - (function (_ key parameters input) - (let [dependencies (default_dependencies prelude input)] - [///.#dependencies dependencies - ///.#process (function (_ state archive) - (do [! try.monad] - [.let [hash (text#hash (the ///.#code input))] - [state [source buffer]] (<| (///phase.result' state) - (..begin dependencies hash input)) - .let [module (the ///.#module input)]] - (loop (again [iteration (<| (///phase.result' state) - (..iteration wrapper archive expander module source buffer ///syntax.no_aliases))]) - (do ! - [[state ?source&requirements&temporary_payload] iteration] - (case ?source&requirements&temporary_payload - {.#None} - (do ! - [[state [analysis_module [final_buffer final_registry]]] (///phase.result' state (..end module)) - .let [descriptor [descriptor.#hash hash - descriptor.#name module - descriptor.#file (the ///.#file input) - descriptor.#references (set.of_list text.hash dependencies) - descriptor.#state {.#Compiled}]]] - (in [state - {.#Right [[module.#id (try.else module.runtime (archive.id module archive)) - module.#descriptor descriptor - module.#document (document.document key analysis_module)] - (sequence#each (function (_ [artifact_id custom declaration]) - [artifact_id custom (write_declaration declaration)]) - final_buffer) - final_registry]}])) +(with_expansions [<parameters> (these anchor expression declaration)] + (def (define_program! archive program global program_module program_definition) + (All (_ <parameters>) + (-> Archive + (Program expression declaration) (-> Archive Symbol (///generation.Operation <parameters> expression)) + descriptor.Module Text + (///generation.Operation <parameters> Any))) + (do ///phase.monad + [ [@program _] (///generation.definition archive [program_module program_definition]) + @self (///generation.learn [///program.name {.#None}] true (set.has @program (set.empty unit.hash))) + + |program| (global archive [program_module program_definition]) + @module (///phase.lifted (archive.id program_module archive))] + (///generation.save! @self {.#None} (program [@module @self] |program|)))) + + (def .public (compiler program global wrapper expander prelude write_declaration program_module program_definition) + (All (_ anchor expression declaration) + (-> (Program expression declaration) (-> Archive Symbol (///generation.Operation <parameters> expression)) + ///phase.Wrapper Expander descriptor.Module (-> declaration Binary) + descriptor.Module (Maybe Text) + (Instancer (///declaration.State+ <parameters>) .Module))) + (let [execute! (declarationP.phase wrapper expander)] + (function (_ key parameters input) + (let [dependencies (default_dependencies prelude input)] + [///.#dependencies dependencies + ///.#process (function (_ state archive) + (do [! try.monad] + [.let [hash (text#hash (the ///.#code input))] + [state [source buffer]] (<| (///phase.result' state) + (..begin dependencies hash input)) + .let [module (the ///.#module input)]] + (loop (again [iteration (<| (///phase.result' state) + (..iteration wrapper archive expander module source buffer ///syntax.no_aliases))]) + (do ! + [[state ?source&requirements&temporary_payload] iteration] + (case ?source&requirements&temporary_payload + {.#None} + (do ! + [[state [analysis_module [final_buffer final_registry]]] + (<| (///phase.result' state) + (do [! ///phase.monad] + [_ (if (text#= program_module module) + (case program_definition + {.#Some program_definition} + (///declaration.lifted_generation + (define_program! archive program global program_module program_definition)) + + {.#None} + (in [])) + (in []))] + (..end module))) + + .let [descriptor [descriptor.#hash hash + descriptor.#name module + descriptor.#file (the ///.#file input) + descriptor.#references (set.of_list text.hash dependencies) + descriptor.#state {.#Compiled}]]] + (in [state + {.#Right [[module.#id (try.else module.runtime (archive.id module archive)) + module.#descriptor descriptor + module.#document (document.document key analysis_module)] + (sequence#each (function (_ [artifact_id custom declaration]) + [artifact_id custom (write_declaration declaration)]) + final_buffer) + final_registry]}])) - {.#Some [source requirements temporary_payload]} - (let [[temporary_buffer temporary_registry] temporary_payload] - (in [state - {.#Left [///.#dependencies (|> requirements - (the ///declaration.#imports) - (list#each product.left)) - ///.#process (function (_ state archive) - (again (<| (///phase.result' state) - (do [! ///phase.monad] - [analysis_module (<| (is (Operation .Module)) - ///declaration.lifted_analysis - extension.lifted - meta.current_module) - _ (///declaration.lifted_generation - (///generation.set_buffer temporary_buffer)) - _ (///declaration.lifted_generation - (///generation.set_registry temporary_registry)) - _ (|> requirements - (the ///declaration.#referrals) - (monad.each ! (execute! archive))) - temporary_payload (..get_current_payload temporary_payload)] - (..iteration wrapper archive expander module source temporary_payload (..module_aliases analysis_module))))))]}])) - )))))])))) + {.#Some [source requirements temporary_payload]} + (let [[temporary_buffer temporary_registry] temporary_payload] + (in [state + {.#Left [///.#dependencies (|> requirements + (the ///declaration.#imports) + (list#each product.left)) + ///.#process (function (_ state archive) + (again (<| (///phase.result' state) + (do [! ///phase.monad] + [analysis_module (<| (is (Operation .Module)) + ///declaration.lifted_analysis + extension.lifted + meta.current_module) + _ (///declaration.lifted_generation + (///generation.set_buffer temporary_buffer)) + _ (///declaration.lifted_generation + (///generation.set_registry temporary_registry)) + _ (|> requirements + (the ///declaration.#referrals) + (monad.each ! (execute! archive))) + temporary_payload (..get_current_payload temporary_payload)] + (..iteration wrapper archive expander module source temporary_payload (..module_aliases analysis_module))))))]}])) + )))))])))) + ) diff --git a/stdlib/source/library/lux/meta/compiler/default/platform.lux b/stdlib/source/library/lux/meta/compiler/default/platform.lux index 436d6bac3..b0ce99018 100644 --- a/stdlib/source/library/lux/meta/compiler/default/platform.lux +++ b/stdlib/source/library/lux/meta/compiler/default/platform.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except) + [lux (.except Module) ["[0]" debug] [abstract ["[0]" monad (.only Monad do)]] @@ -64,7 +64,7 @@ ["[0]" registry (.only Registry)] ["[0]" artifact] ["[0]" module (.only) - ["[0]" descriptor (.only Descriptor)] + ["[0]" descriptor (.only Descriptor Module)] ["[0]" document (.only Document)]]] ["[0]" io ["_[1]" /] @@ -693,11 +693,12 @@ product.left) archive)) - (def (compiler phase_wrapper expander platform) + (def (compiler program global phase_wrapper expander platform program_module program_definition) (All (_ <type_vars>) - (-> ///phase.Wrapper Expander <Platform> + (-> (Program expression declaration) (-> Archive Symbol (///generation.Operation <type_vars> expression)) + ///phase.Wrapper Expander <Platform> Text (Maybe Module) (///.Compiler <State+> .Module Any))) - (let [instancer (//init.compiler phase_wrapper expander syntax.prelude (the #write platform))] + (let [instancer (//init.compiler program global phase_wrapper expander syntax.prelude (the #write platform) program_module program_definition)] (instancer $.key (list)))) (def (custom_compiler import context platform compilation_sources compiler @@ -868,11 +869,13 @@ {try.#Success [context (the compiler.#parameters it) /#value]} (exception.except ..invalid_custom_compiler [/#definition /#type])))))) - (def .public (compile lux_compiler phase_wrapper import file_context expander platform compilation context) + (def .public (compile program global lux_compiler phase_wrapper import file_context expander platform compilation context) (All (_ <type_vars>) - (-> (-> Any ..Custom) ///phase.Wrapper Import context.Context Expander <Platform> Compilation Lux_Context Lux_Return)) - (let [[host_dependencies libraries compilers sources target module configuration] compilation - import! (|> (..compiler phase_wrapper expander platform) + (-> (Program expression declaration) (-> Archive Symbol (///generation.Operation <type_vars> expression)) + (-> Any ..Custom) ///phase.Wrapper Import context.Context Expander <Platform> Compilation Lux_Context + Lux_Return)) + (let [[host_dependencies libraries compilers sources target program_module program_definition configuration] compilation + import! (|> (..compiler program global phase_wrapper expander platform program_module program_definition) (serial_compiler import file_context platform sources) (..parallel context))] (do [! ..monad] @@ -884,5 +887,5 @@ lux_compiler (function.on parameters)))))) (monad.all !))] - (import! customs descriptor.runtime module)))) + (import! customs descriptor.runtime program_module)))) ))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux index 5c0593b49..b127af8c6 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux @@ -271,7 +271,7 @@ (/////generation.log! (format tag " : Tag of " (%.type owner)))) labels))) -(def (deftype_tagged expander host_analysis) +(def (def_type_tagged expander host_analysis) (-> Expander /////analysis.Bundle Handler) (..custom [(all <>.and <code>.local <code>.any @@ -459,83 +459,27 @@ (phase.except ///.invalid_syntax [extension_name %.code inputsC+]))))] ["Analysis" - defanalysis + def_analysis /////analysis.Handler /////analysis.Handler /////declaration.lifted_analysis ..analyser] ["Synthesis" - defsynthesis + def_synthesis /////synthesis.Handler /////synthesis.Handler /////declaration.lifted_synthesis ..synthesizer] ["Generation" - defgeneration + def_generation (/////generation.Handler anchorT expressionT declarationT) (/////generation.Handler anchor expression declaration) /////declaration.lifted_generation ..generator] ["Declaration" - defdeclaration + def_declaration (/////declaration.Handler anchorT expressionT declarationT) (/////declaration.Handler anchor expression declaration) (<|) ..declaration] ) -... TODO; Both "prepare-program" and "define-program" exist only -... because the old compiler couldn't handle a fully-inlined definition -... for "defprogram". Inline them ASAP. -(def (prepare_program archive analyse synthesize programC) - (All (_ anchor expression declaration output) - (-> Archive - /////analysis.Phase - /////synthesis.Phase - Code - (Operation anchor expression declaration Synthesis))) - (do phase.monad - [[_ programA] (<| /////declaration.lifted_analysis - scope.with - typeA.fresh - (typeA.expecting (type_literal (-> (List Text) (IO Any)))) - (analyse archive programC))] - (/////declaration.lifted_synthesis - (synthesize archive programA)))) - -(def (define_program archive @module generate program programS) - (All (_ anchor expression declaration output) - (-> Archive - module.ID - (/////generation.Phase anchor expression declaration) - (Program expression declaration) - Synthesis - (/////generation.Operation anchor expression declaration Any))) - (do phase.monad - [dependencies (cache/artifact.dependencies archive programS) - [interim_artifacts programG] (/////generation.with_interim_artifacts archive - (generate archive programS)) - @self (/////generation.learn [/////program.name {.#None}] true (list#mix set.has dependencies interim_artifacts))] - (/////generation.save! @self {.#None} (program [@module @self] programG)))) - -(def (defprogram program) - (All (_ anchor expression declaration) - (-> (Program expression declaration) (Handler anchor expression declaration))) - (function (handler extension_name phase archive inputsC+) - (case inputsC+ - (list programC) - (do phase.monad - [state (///.lifted phase.state) - .let [analyse (the [/////declaration.#analysis /////declaration.#phase] state) - synthesize (the [/////declaration.#synthesis /////declaration.#phase] state) - generate (the [/////declaration.#generation /////declaration.#phase] state)] - programS (prepare_program archive analyse synthesize programC) - current_module (/////declaration.lifted_analysis - (///.lifted meta.current_module_name)) - @module (phase.lifted (archive.id current_module archive)) - _ (/////declaration.lifted_generation - (define_program archive @module generate program programS))] - (in /////declaration.no_requirements)) - - _ - (phase.except ///.invalid_syntax [extension_name %.code inputsC+])))) - (def (bundle::def expander host_analysis program anchorT,expressionT,declarationT extender) (All (_ anchor expression declaration) (-> Expander @@ -548,12 +492,11 @@ (|> ///bundle.empty (dictionary.has "module" defmodule) (dictionary.has "alias" defalias) - (dictionary.has "type tagged" (deftype_tagged expander host_analysis)) - (dictionary.has "analysis" (defanalysis anchorT,expressionT,declarationT extender)) - (dictionary.has "synthesis" (defsynthesis anchorT,expressionT,declarationT extender)) - (dictionary.has "generation" (defgeneration anchorT,expressionT,declarationT extender)) - (dictionary.has "declaration" (defdeclaration anchorT,expressionT,declarationT extender)) - (dictionary.has "program" (defprogram program)) + (dictionary.has "type tagged" (def_type_tagged expander host_analysis)) + (dictionary.has "analysis" (def_analysis anchorT,expressionT,declarationT extender)) + (dictionary.has "synthesis" (def_synthesis anchorT,expressionT,declarationT extender)) + (dictionary.has "generation" (def_generation anchorT,expressionT,declarationT extender)) + (dictionary.has "declaration" (def_declaration anchorT,expressionT,declarationT extender)) ))) (def .public (bundle expander host_analysis program anchorT,expressionT,declarationT extender) diff --git a/stdlib/source/library/lux/meta/compiler/meta/cli.lux b/stdlib/source/library/lux/meta/compiler/meta/cli.lux index 72e8b7ef1..21d0885ad 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/cli.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/cli.lux @@ -56,6 +56,7 @@ #sources (List Source) #target Target #module Module + #program (Maybe Text) #configuration Configuration])) (type .public Interpretation @@ -84,6 +85,10 @@ [configuration_parser "--configuration" Configuration (<text>.then configuration.parser <program>.any)] ) +(def program_parser + (Parser (Maybe Text)) + (<>.maybe (<program>.named "--program" <program>.any))) + (def .public service (Parser Service) (let [compilation (is (Parser Compilation) @@ -94,6 +99,7 @@ (<>.some ..source_parser) ..target_parser ..module_parser + ..program_parser (<>.else configuration.empty ..configuration_parser)))] (all <>.or (<>.after (<program>.this "build") diff --git a/stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux b/stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux index 39bc028af..1c0d70dc2 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/packager/ruby.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - [type (.only sharing)] [abstract ["[0]" monad (.only do)]] [control @@ -22,6 +21,7 @@ [number ["[0]" nat]]] [meta + [type (.only sharing)] [target ["_" ruby]]] [world diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux index f7fd562eb..acfe5a74c 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -5,7 +5,7 @@ [monad (.only do)]] [control ["<>" parser] - ["[0]" io] + ["[0]" io (.only IO)] [concurrency ["[0]" thread]]] [meta @@ -16,6 +16,9 @@ [syntax (.only syntax)]]]]] ["</>" \\parser]) +(type .public Program + (-> (List Text) (IO Any))) + (type Arguments (Variant {#Raw Text} @@ -26,7 +29,7 @@ (<>.or <code>.local (<code>.tuple (<>.some <code>.any)))) -(def .public program: +(def .public program (syntax (_ [args ..arguments^ body <code>.any]) (with_symbols [g!program g!args g!_ g!output g!message] @@ -39,22 +42,22 @@ [(, g!output) (, body) (, g!_) (,! thread.run!)] ((,' in) (, g!output)))))] - (in (list (` ("lux def program" - (, (case args - {#Raw args} - (` (.function ((, g!program) (, (code.symbol ["" args]))) - (, initialization+event_loop))) - - {#Parsed args} - (` (.function ((, g!program) (, g!args)) - (case ((,! </>.result) (.is (,! (</>.Parser (io.IO .Any))) - ((,! do) (,! <>.monad) - [(,* args) - (, g!_) (,! </>.end)] - ((,' in) (, initialization+event_loop)))) - (, g!args)) - {.#Right (, g!output)} - (, g!output) + (in (list (` (is Program + (, (case args + {#Raw args} + (` (.function ((, g!program) (, (code.symbol ["" args]))) + (, initialization+event_loop))) + + {#Parsed args} + (` (.function ((, g!program) (, g!args)) + (case ((,! </>.result) (.is (,! (</>.Parser (io.IO .Any))) + ((,! do) (,! <>.monad) + [(,* args) + (, g!_) (,! </>.end)] + ((,' in) (, initialization+event_loop)))) + (, g!args)) + {.#Right (, g!output)} + (, g!output) - {.#Left (, g!message)} - (.panic! (, g!message))))))))))))))) + {.#Left (, g!message)} + (.panic! (, g!message))))))))))))))) diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index 870ae6dd3..f94f56037 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except local) - [program (.only program:)] + ["[0]" program] ["[0]" debug] [abstract [monad (.only do)]] @@ -10,8 +10,6 @@ ["[0]" maybe] ["[0]" try (.only Try) (.use "[1]#[0]" functor)] ["[0]" exception (.only exception)] - [parser - [environment (.only Environment)]] [concurrency ["[0]" async (.only Async) (.use "[1]#[0]" monad)]]] [data @@ -34,7 +32,7 @@ [world ["[0]" shell (.only Exit Shell)] ["[0]" console (.only Console)] - ["[0]" program (.only Program)] + ["[0]" environment] ["[0]" file (.only Path) ["[0]" watch]] [net @@ -69,30 +67,30 @@ set.list (list#each (|>> (/repository/remote.repository http.default {.#None}) /repository.async)))) -(def program (program.async program.default)) +(def environment (environment.async environment.default)) (def fs (file.async file.default)) -(def local (/repository/local.repository ..program ..fs)) +(def local (/repository/local.repository ..environment ..fs)) -(def (with_dependencies program console command profile) +(def (with_dependencies environment console command profile) (All (_ a) - (-> (Program Async) (Console Async) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) + (-> (environment.Environment Async) (Console Async) + (-> (Console Async) (environment.Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) (Command a))) (do /action.monad [resolution (/command/deps.do! console - (/repository/local.repository program (file.async file.default)) + (/repository/local.repository environment (file.async file.default)) (..repositories profile) (|>> (/repository/remote.repository http.default {.#None}) /repository.async) profile) - [exit_code output] ((command console program (file.async file.default) (shell.async shell.default) resolution) profile) + [exit_code output] ((command console environment (file.async file.default) (shell.async shell.default) resolution) profile) _ (case exit_code (static shell.normal) (in []) _ (do async.monad - [_ (at program exit exit_code)] + [_ (at environment exit exit_code)] (in {try.#Failure ""})))] (in output))) @@ -106,13 +104,13 @@ (def succeed! (IO Any) - (at program.default exit shell.normal)) + (at environment.default exit shell.normal)) (def (fail! error) (-> Text (IO Any)) (exec (debug.log! error) - (at program.default exit shell.error))) + (at environment.default exit shell.error))) (def (command action) (All (_ a) (-> (Async (Try a)) (IO Any))) @@ -150,86 +148,87 @@ (maybe.trusted (text.clip 0 (-- (text.size it)) it)) it)))))) -(program: [[profiles operation] /cli.command] - (do [! io.monad] - [console (at ! each (|>> (try.else ..write_only) console.async) - console.default)] - (case operation - {/cli.#Version} - (..command - (/command/version.do! console (at /.monoid identity))) - - _ - (do ! - [?profile (/input.read io.monad file.default profiles)] - (case ?profile - {try.#Failure error} - (..fail! error) - - {try.#Success profile} - (case operation - {/cli.#Version} - (in []) - - {/cli.#Clean} - (..command - (/command/clean.do! console (file.async file.default) profile)) - - {/cli.#POM} - (..command - (/command/pom.do! console (file.async file.default) profile)) - - {/cli.#Install} - (..command - (/command/install.do! console ..fs ..local profile)) - - {/cli.#Deploy repository identity} - (..command - (case (the /.#identity profile) - {.#Some artifact} - (case (dictionary.value repository (the /.#deploy_repositories profile)) - {.#Some remote} - (/command/deploy.do! ..program - (shell.async shell.default) - console - ..local - (/repository.async (/repository/remote.repository http.default {.#Some identity} remote)) - (file.async file.default) - artifact - profile) +(def _ + (program.program [[profiles operation] /cli.command] + (do [! io.monad] + [console (at ! each (|>> (try.else ..write_only) console.async) + console.default)] + (case operation + {/cli.#Version} + (..command + (/command/version.do! console (at /.monoid identity))) + + _ + (do ! + [?profile (/input.read io.monad file.default profiles)] + (case ?profile + {try.#Failure error} + (..fail! error) + + {try.#Success profile} + (case operation + {/cli.#Version} + (in []) + + {/cli.#Clean} + (..command + (/command/clean.do! console (file.async file.default) profile)) + + {/cli.#POM} + (..command + (/command/pom.do! console (file.async file.default) profile)) + + {/cli.#Install} + (..command + (/command/install.do! console ..fs ..local profile)) + + {/cli.#Deploy repository identity} + (..command + (case (the /.#identity profile) + {.#Some artifact} + (case (dictionary.value repository (the /.#deploy_repositories profile)) + {.#Some remote} + (/command/deploy.do! ..environment + (shell.async shell.default) + console + ..local + (/repository.async (/repository/remote.repository http.default {.#Some identity} remote)) + (file.async file.default) + artifact + profile) + + {.#None} + (async#in (exception.except ..cannot_find_repository [repository (the /.#deploy_repositories profile)]))) {.#None} - (async#in (exception.except ..cannot_find_repository [repository (the /.#deploy_repositories profile)]))) - - {.#None} - (async#in (exception.except /.no_identity [])))) - - {/cli.#Dependencies} - (..command - (/command/deps.do! console - (/repository/local.repository ..program (file.async file.default)) - (..repositories profile) - (|>> (/repository/remote.repository http.default {.#None}) - /repository.async) - profile)) - - {/cli.#Compilation compilation} - (case compilation - {/cli.#Build} (..command - (..with_dependencies ..program console /command/build.do! profile)) - {/cli.#Test} (..command - (..with_dependencies ..program console /command/test.do! profile))) - - {/cli.#Auto auto} - (do ! - [?watcher watch.default] - (case ?watcher - {try.#Failure error} - (..fail! error) - - {try.#Success watcher} - (..command - (case auto - {/cli.#Build} (..with_dependencies ..program console (/command/auto.do! /command/auto.delay watcher /command/build.do!) profile) - {/cli.#Test} (..with_dependencies ..program console (/command/auto.do! /command/auto.delay watcher /command/test.do!) profile)))))) - ))))) + (async#in (exception.except /.no_identity [])))) + + {/cli.#Dependencies} + (..command + (/command/deps.do! console + (/repository/local.repository ..environment (file.async file.default)) + (..repositories profile) + (|>> (/repository/remote.repository http.default {.#None}) + /repository.async) + profile)) + + {/cli.#Compilation compilation} + (case compilation + {/cli.#Build} (..command + (..with_dependencies ..environment console /command/build.do! profile)) + {/cli.#Test} (..command + (..with_dependencies ..environment console /command/test.do! profile))) + + {/cli.#Auto auto} + (do ! + [?watcher watch.default] + (case ?watcher + {try.#Failure error} + (..fail! error) + + {try.#Success watcher} + (..command + (case auto + {/cli.#Build} (..with_dependencies ..environment console (/command/auto.do! /command/auto.delay watcher /command/build.do!) profile) + {/cli.#Test} (..with_dependencies ..environment console (/command/auto.do! /command/auto.delay watcher /command/test.do!) profile)))))) + )))))) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/time.lux b/stdlib/source/program/aedifex/artifact/snapshot/time.lux index b4fb82186..9d9492965 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/time.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/time.lux @@ -17,7 +17,7 @@ [time ["[0]" instant (.only Instant)]]]]] ["[0]" /// - ["[1][0]" time + ["[1][0]" time (.only) ["[1]/[0]" date] ["[1]/[0]" time]]]) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux index 3ab65cab4..7bf1b9e3e 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux @@ -8,7 +8,7 @@ ["<>" parser]] [data ["[0]" product] - ["[0]" text + ["[0]" text (.only) ["<[1]>" \\parser]] [format ["[0]" xml (.only XML) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux index 534283b7f..54d190c44 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux @@ -5,7 +5,7 @@ [equivalence (.only Equivalence)]] [data ["[0]" product] - ["[0]" text + ["[0]" text (.only) ["%" \\format]]]]] ["[0]" /// (.only Snapshot) ["[1][0]" time] diff --git a/stdlib/source/program/aedifex/artifact/time/time.lux b/stdlib/source/program/aedifex/artifact/time/time.lux index 01e2c85cb..f093c7577 100644 --- a/stdlib/source/program/aedifex/artifact/time/time.lux +++ b/stdlib/source/program/aedifex/artifact/time/time.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["[0]" time] [abstract [monad (.only do)]] [control @@ -12,7 +11,9 @@ ["<[1]>" \\parser (.only Parser)]]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [world + ["[0]" time]]]] ["[0]" // ["[1]" date]]) diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index 26a1fd325..8e74893a2 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -5,12 +5,13 @@ [equivalence (.only Equivalence)] [monad (.only do)]] [control - ["<>" parser - ["[0]" cli (.only Parser)]]] + ["<>" parser]] [data ["[0]" sum] ["[0]" product] - ["[0]" text]]]] + ["[0]" text]] + [program + ["cli" \\parser (.only Parser)]]]] [// [repository [identity (.only Identity)]] diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index 15d78527b..4e4871f52 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -12,7 +12,7 @@ ["[0]" list] ["[0]" set]]] [world - [program (.only Program)] + [environment (.only Environment)] [shell (.only Exit Shell)] [console (.only Console)] ["[0]" file (.only) @@ -46,11 +46,11 @@ (def .public (do! delay watcher command) (All (_ a) (-> Nat (Watcher Async) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])))) - (function (_ console program fs shell resolution) + (-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) + (-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])))) + (function (_ console environment fs shell resolution) (function (_ profile) - (with_expansions [<call> ((command console program fs shell resolution) profile)] + (with_expansions [<call> ((command console environment fs shell resolution) profile)] (do [! async.monad] [targets (|> profile (the ///.#sources) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 9eae7660d..190ec3802 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -16,7 +16,7 @@ ["[0]" text (.use "[1]#[0]" order) ["%" \\format (.only format)]] [collection - ["[0]" list (.use "[1]#[0]" functor mix)] + ["[0]" list (.use "[1]#[0]" functor mix monoid)] ["[0]" dictionary (.only Dictionary)] ["[0]" set]]] [math @@ -34,7 +34,7 @@ ["[0]" packager (.only) ["[0]_[1]" ruby]]]]] [world - ["[0]" program (.only Program)] + ["[0]" environment (.only Environment)] ["[0]" file (.only Path)] ["[0]" shell (.only Exit Process Shell)] ["[0]" console (.only Console)] @@ -275,19 +275,19 @@ "--add-opens" "java.base/java.lang=ALL-UNNAMED")) runtime))) -(def .public (do! console program fs shell resolution) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Lux Path])) +(def .public (do! console environment fs shell resolution) + (-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit Lux Path])) (function (_ profile) (let [target (the ///.#target profile)] (case (the ///.#program profile) {.#None} (async#in (exception.except ..no_specified_program [])) - {.#Some program_module} + {.#Some [program_module program_definition]} (do async.monad - [environment (program.environment async.monad program) - .let [home (at program home) - working_directory (at program directory)]] + [.let [home (at environment home) + working_directory (at environment directory)] + environment (environment.environment async.monad environment)] (do ///action.monad [[resolution lux] (async#in (..lux resolution (the ///.#lux profile))) .let [host_dependencies (..host_dependencies fs home resolution) @@ -320,7 +320,10 @@ (..plural "--compiler" (list#each compiler.format (the ///.#compilers profile))) (..plural "--source" (set.list (the ///.#sources profile))) (..singular "--target" cache_directory) - (..singular "--module" program_module) + (case program_module + "" (..singular "--module" program_definition) + _ (list#composite (..singular "--module" program_module) + (..singular "--program" program_definition))) (..singular "--configuration" (configuration.format (the ///.#configuration profile)))))] process (at shell execute [(dictionary.composite environment command_environment) working_directory diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index c579f165a..c4dfe7c7d 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -8,7 +8,7 @@ [concurrency [async (.only Async)]]] [world - [program (.only Program)] + [environment (.only Environment)] [shell (.only Shell)] ["[0]" file] ["[0]" console (.only Console)]]]] @@ -26,11 +26,11 @@ (def .public success "Successfully deployed the project.") -(def .public (do! program shell console local remote fs artifact profile) - (-> (Program Async) (Shell Async) (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any)) +(def .public (do! environment shell console local remote fs artifact profile) + (-> (Environment Async) (Shell Async) (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any)) (do [! ///action.monad] [_ (if (/snapshot.snapshot? artifact) (/snapshot.do! console remote fs artifact profile) - (/release.do! program shell console local remote fs artifact profile))] + (/release.do! environment shell console local remote fs artifact profile))] (is (Async (Try Any)) (console.write_line ..success console)))) diff --git a/stdlib/source/program/aedifex/command/deploy/release.lux b/stdlib/source/program/aedifex/command/deploy/release.lux index e30c115d2..d7394d7a3 100644 --- a/stdlib/source/program/aedifex/command/deploy/release.lux +++ b/stdlib/source/program/aedifex/command/deploy/release.lux @@ -3,7 +3,6 @@ [lux (.except) ["[0]" ffi (.only import)] [abstract - [predicate (.only Predicate)] ["[0]" monad (.only do)]] [control ["[0]" pipe] @@ -11,8 +10,8 @@ ["[0]" io (.only IO)] [concurrency ["[0]" async (.only Async)]] - [parser - ["[0]" environment]]] + [function + [predicate (.only Predicate)]]] [data [binary (.only Binary)] ["[0]" text (.only) @@ -34,7 +33,9 @@ ["[0]" packager ["[1]" jvm]]]]] [world - [program (.only Program)] + ["[0]" environment + [/ (.only Environment)] + ["[1]" \\parser]] [console (.only Console)] ["[0]" shell (.only Shell)] ["[0]" file]]]] @@ -112,8 +113,8 @@ (Predicate Artifact) (|>> //snapshot.snapshot? not)) -(def (install_dummies! program local fs artifact) - (-> (Program Async) (Repository Async) (file.System Async) Artifact (Async (Try Any))) +(def (install_dummies! environment local fs artifact) + (-> (Environment Async) (Repository Async) (file.System Async) Artifact (Async (Try Any))) (do (try.with async.monad) [.let [$artifact (////artifact.uri (the ////artifact.#version artifact) artifact)] _ (at local upload (..jar $artifact) ..dummy_jar) @@ -144,13 +145,13 @@ _ (..release_unsigned_artifact! local remote signature)] (in []))) -(def .public (do! program shell console local remote fs artifact profile) - (-> (Program Async) (Shell Async) (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any)) +(def .public (do! environment shell console local remote fs artifact profile) + (-> (Environment Async) (Shell Async) (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any)) (do [! ////action.monad] [_ (///install.do! console fs local profile) - _ (install_dummies! program local fs artifact) - .let [working_directory (at program directory) - @root (////repository/local.root program fs) + _ (install_dummies! environment local fs artifact) + .let [working_directory (at environment directory) + @root (////repository/local.root environment fs) $bundle (////artifact.bundle (the ////artifact.#version artifact) artifact) / (at fs separator) @local (%.format @root / $bundle)] diff --git a/stdlib/source/program/aedifex/command/deploy/snapshot.lux b/stdlib/source/program/aedifex/command/deploy/snapshot.lux index eec503275..bd253bfcd 100644 --- a/stdlib/source/program/aedifex/command/deploy/snapshot.lux +++ b/stdlib/source/program/aedifex/command/deploy/snapshot.lux @@ -2,15 +2,16 @@ [library [lux (.except) [abstract - [monad (.only do)] - [predicate (.only Predicate)]] + [monad (.only do)]] [control + [function + [predicate (.only Predicate)]] [concurrency ["[0]" async (.only Async)]]] [data ["[0]" binary ["[1]" \\format]] - ["[0]" text + ["[0]" text (.only) [encoding ["[0]" utf8]]] [collection diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index 4ffc6e641..4ec5693f0 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -16,7 +16,6 @@ ["%" \\format]]] [world [net (.only URL)] - [program (.only Program)] ["[0]" file] ["[0]" console (.only Console)]]]] ["[0]" // diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux index 2bd647a44..67739203a 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -25,7 +25,6 @@ [meta ["[0]" export]]]] [world - [program (.only Program)] ["[0]" file] ["[0]" console (.only Console)]]]] ["[0]" // diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 7acc3e8c9..16a2694d4 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -17,7 +17,7 @@ [macro ["^" pattern]]] [world - ["[0]" program (.only Program)] + ["[0]" environment (.only Environment)] ["[0]" file] ["[0]" shell (.only Exit Shell)] ["[0]" console (.only Console)]]]] @@ -35,14 +35,14 @@ (def .public success "[TEST ENDED]") (def .public failure "[TEST FAILED]") -(def .public (do! console program fs shell resolution profile) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])) +(def .public (do! console environment fs shell resolution profile) + (-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])) (do async.monad - [environment (program.environment async.monad program) - .let [working_directory (at program directory)]] + [.let [home (at environment home) + working_directory (at environment directory)] + environment_vars (environment.environment async.monad environment)] (do [! ///action.monad] - [.let [home (at program home)] - [build_exit compiler program] (//build.do! console program fs shell resolution + [[build_exit compiler program] (//build.do! console environment fs shell resolution (has ///.#program (the ///.#test profile) profile))] (if (i.= shell.normal build_exit) (do ! @@ -63,7 +63,7 @@ [//build.#Python ///.#python] [//build.#Lua ///.#lua] [//build.#Ruby ///.#ruby]))] - process (at shell execute [(dictionary.composite environment command_environment) + process (at shell execute [(dictionary.composite environment_vars command_environment) working_directory test_command test_parameters]) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 7cabf5b88..ae075b5b0 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -6,17 +6,18 @@ [abstract [codec (.only Codec)] [equivalence (.only Equivalence)] - [monad (.only do)] - ["[0]" predicate (.only Predicate)]] + [monad (.only do)]] [control ["[0]" maybe] ["[0]" try (.only Try) (.use "[1]#[0]" functor)] ["[0]" exception (.only Exception exception)] + [function + ["[0]" predicate (.only Predicate)]] [concurrency ["[0]" async (.only Async)]]] [data ["[0]" binary (.only Binary)] - ["[0]" textnone + ["[0]" text (.only) ["%" \\format (.only format)] [encoding ["[0]" utf8]]] @@ -49,7 +50,7 @@ ["[1][0]" artifact (.only Version Artifact) ["[1]/[0]" extension (.only Extension)] ["[1]/[0]" versioning] - ["[0]" snapshotnone + ["[0]" snapshot (.only) [version ["[0]" value]]]] ["[1][0]" repository (.only Repository) @@ -222,12 +223,13 @@ tail resolution) _ (do [! async.monad] - [?package (case (dictionary.value head resolution) - {.#Some package} - (in {try.#Success package}) + [?package (is (Async (Try Package)) + (case (dictionary.value head resolution) + {.#Some package} + (in {try.#Success package}) - {.#None} - (..any console repositories head))] + {.#None} + (..any console repositories head)))] (case ?package {try.#Success package} (do ! diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 06dfa2988..5eb32d757 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -8,8 +8,8 @@ ["[0]" list (.use "[1]#[0]" monad)] ["[0]" set (.only Set)]]] [meta + ["[0]" code] [macro - ["[0]" code] ["[0]" template]] [compiler [meta @@ -171,8 +171,8 @@ (..on_list "compilers" (the /.#compilers value) ..compiler) (..on_set "sources" (the /.#sources value) code.text) (dictionary.has "target" (code.text (the /.#target value))) - (..on_maybe "program" (the /.#program value) code.text) - (..on_maybe "test" (the /.#test value) code.text) + (..on_maybe "program" (the /.#program value) code.symbol) + (..on_maybe "test" (the /.#test value) code.symbol) (..on_dictionary "deploy_repositories" (the /.#deploy_repositories value) code.text code.text) (,, (with_template [<tag>] [(dictionary.has (template.text [<tag>]) (..runtime (the <tag> value)))] diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index b292f004b..4506720a1 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -11,7 +11,7 @@ ["[0]" exception (.only exception)]] [data ["[0]" binary (.only Binary)] - ["[0]" text + ["[0]" text (.only) ["%" \\format (.only Format format)] ["[0]" encoding]]] [math diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index a29cb49a7..509d8e16f 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -9,7 +9,7 @@ ["[0]" try (.only Try)]] [data [binary (.only Binary)] - ["[0]" text + ["[0]" text (.only) [encoding ["[0]" utf8]]] [collection diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 95197c4d9..0327a4cd9 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Module) + [lux (.except type) [abstract [monad (.only do)]] [control @@ -19,10 +19,7 @@ [compiler [meta [cli - [compiler (.only Compiler)]] - [archive - [module - [descriptor (.only Module)]]]]]] + [compiler (.only Compiler)]]]]] [world [net (.only URL)]]]] ["[0]" // @@ -171,9 +168,13 @@ (Parser /.Target) <code>.text) -(def module - (Parser Module) - <code>.text) +(def module_or_program + (Parser Symbol) + <code>.symbol) + +(def program + (Parser Symbol) + <code>.global) (def deploy_repository (Parser [Text //repository.Address]) @@ -234,12 +235,12 @@ (|> ..target (..singular input "target") (<>.else /.default_target))) - ^program (is (Parser (Maybe Module)) + ^program (is (Parser (Maybe Symbol)) (<>.maybe - (..singular input "program" ..module))) - ^test (is (Parser (Maybe Module)) + (..singular input "program" ..module_or_program))) + ^test (is (Parser (Maybe Symbol)) (<>.maybe - (..singular input "test" ..module))) + (..singular input "test" ..program))) ^deploy_repositories (is (Parser (Dictionary Text //repository.Address)) (<| (at ! each (dictionary.of_list text.hash)) (<>.else (list)) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 579c21b41..627073d79 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -175,8 +175,8 @@ #compilers (List Compiler) #sources (Set Source) #target Target - #program (Maybe Module) - #test (Maybe Module) + #program (Maybe Symbol) + #test (Maybe Symbol) #deploy_repositories (Dictionary Text Address) #configuration (property.List Text) #java Runtime @@ -207,9 +207,9 @@ ... #target text.equivalence ... #program - (maybe.equivalence text.equivalence) + (maybe.equivalence symbol.equivalence) ... #test - (maybe.equivalence text.equivalence) + (maybe.equivalence symbol.equivalence) ... #deploy_repositories (dictionary.equivalence text.equivalence) ... #configuration diff --git a/stdlib/source/program/aedifex/repository/identity.lux b/stdlib/source/program/aedifex/repository/identity.lux index 348a3fc46..eaca93cdb 100644 --- a/stdlib/source/program/aedifex/repository/identity.lux +++ b/stdlib/source/program/aedifex/repository/identity.lux @@ -6,7 +6,7 @@ [equivalence (.only Equivalence)]] [data ["[0]" product] - ["[0]" text + ["[0]" text (.only) ["%" \\format (.only format)] [encoding ["[0]" utf8]]]]]]) diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux index 39a5c8396..af9b502aa 100644 --- a/stdlib/source/program/aedifex/repository/local.lux +++ b/stdlib/source/program/aedifex/repository/local.lux @@ -11,7 +11,7 @@ ["[0]" text (.only) ["%" \\format (.only format)]]] [world - [program (.only Program)] + [environment (.only Environment)] ["[0]" file] [net ["[0]" uri (.only URI)]]]]] @@ -20,37 +20,37 @@ ["[1][0]" local] ["[1][0]" metadata]]]) -(def .public (root program fs) - (-> (Program Async) (file.System Async) file.Path) +(def .public (root environment fs) + (-> (Environment Async) (file.System Async) file.Path) (let [/ (at fs separator)] (|> ///local.repository (text.replaced uri.separator /) - (format (at program home) /)))) + (format (at environment home) /)))) (def (path /) (-> Text (-> URI file.Path)) (text.replaced uri.separator /)) -(def (absolute_path program fs) - (-> (Program Async) (file.System Async) (-> URI file.Path)) +(def (absolute_path environment fs) + (-> (Environment Async) (file.System Async) (-> URI file.Path)) (let [/ (at fs separator)] (|>> ///metadata.local_uri (..path /) - (format (..root program fs) /)))) + (format (..root environment fs) /)))) -(def .public (repository program fs) - (-> (Program Async) (file.System Async) (//.Repository Async)) +(def .public (repository environment fs) + (-> (Environment Async) (file.System Async) (//.Repository Async)) (implementation (def description - (..root program fs)) + (..root environment fs)) (def download - (|>> (..absolute_path program fs) + (|>> (..absolute_path environment fs) (at fs read))) (def (upload uri content) (do [! async.monad] - [.let [absolute_path (..absolute_path program fs uri)] + [.let [absolute_path (..absolute_path environment fs uri)] ? (at fs file? absolute_path) _ (is (Async (Try Any)) (if ? diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index 20d270008..db9e662df 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -5,7 +5,7 @@ [equivalence (.only Equivalence)]] [data ["[0]" product] - ["[0]" text + ["[0]" text (.only) ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" monoid)] diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 3b5150c7e..3f3009b67 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -133,7 +133,7 @@ (with_expansions [<parameters> (these anchor expression artifact)] (def .public (compiler lux_compiler file_context - expander host_analysis platform generation_bundle host_declaration_bundle program anchorT,expressionT,declarationT extender + expander host_analysis platform generation_bundle host_declaration_bundle program global anchorT,expressionT,declarationT extender service packager,package) (All (_ <parameters>) @@ -144,7 +144,7 @@ (IO (Platform <parameters>)) (generation.Bundle <parameters>) (-> phase.Wrapper (declaration.Bundle <parameters>)) - (Program expression artifact) + (Program expression artifact) (-> Archive Symbol (generation.Operation <parameters> expression)) [Type Type Type] (-> phase.Wrapper Extender) Service @@ -157,23 +157,44 @@ (<| (or_crash! "Compilation failed:") ..timed (do (try.with async.monad) - [.let [[compilation_host_dependencies compilation_libraries compilation_compilers compilation_sources compilation_target compilation_module compilation_configuration] compilation] - import (import.import (the platform.#file_system platform) compilation_libraries) + [import (import.import (the platform.#file_system platform) (the cli.#libraries compilation)) [state archive phase_wrapper] (sharing [<parameters>] (is (Platform <parameters>) platform) (is (Async (Try [(declaration.State+ <parameters>) Archive phase.Wrapper])) - (as_expected (platform.initialize file_context compilation_module expander host_analysis platform generation_bundle host_declaration_bundle program anchorT,expressionT,declarationT extender - import compilation_sources compilation_configuration)))) + (as_expected (platform.initialize file_context + (the cli.#module compilation) + expander + host_analysis + platform + generation_bundle + host_declaration_bundle + program + anchorT,expressionT,declarationT + extender + import + (the cli.#sources compilation) + (the cli.#configuration compilation))))) [archive state] (sharing [<parameters>] (is (Platform <parameters>) platform) (is (Async (Try [Archive (declaration.State+ <parameters>)])) - (as_expected (platform.compile lux_compiler phase_wrapper import file_context expander platform compilation [archive state])))) + (as_expected (platform.compile program + global + lux_compiler + phase_wrapper + import + file_context + expander + platform + compilation + [archive state])))) _ (cache.cache! (the platform.#file_system platform) file_context archive) - host_dependencies (..load_host_dependencies (the platform.#file_system platform) compilation_host_dependencies) + host_dependencies (..load_host_dependencies (the platform.#file_system platform) + (the cli.#host_dependencies compilation)) + _ (..package! (for @.old (file.async file.default) @.jvm (file.async file.default) ... TODO: Handle this in a safer manner. diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux index 790b09bdc..f30ec52c0 100644 --- a/stdlib/source/test/aedifex.lux +++ b/stdlib/source/test/aedifex.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [program (.only program:)] + [program (.only program)] ["_" test (.only Test)] [control ["[0]" io]]]] @@ -54,8 +54,9 @@ /runtime.test )) -(program: args - (<| io.io - _.run! - (_.times 100) - ..test)) +(def _ + (program args + (<| io.io + _.run! + (_.times 100) + ..test))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 04d1ca0f9..74983c2a1 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -1,7 +1,7 @@ (.`` (.`` (.require [library ["/" lux (.except) - [program (.only program:)] + [program (.only program)] ["_" test (.only Test)] [abstract [monad (.only do)]] @@ -1212,15 +1212,16 @@ /ffi.test )))) -(program: args - (let [times (for @.old 100 - @.jvm 100 - @.js 10 - @.python 1 - @.lua 1 - @.ruby 1 - 100)] - (<| io.io - _.run! - (_.times times) - ..test))) +(def _ + (program args + (let [times (for @.old 100 + @.jvm 100 + @.js 10 + @.python 1 + @.lua 1 + @.ruby 1 + 100)] + (<| io.io + _.run! + (_.times times) + ..test)))) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cli.lux b/stdlib/source/test/lux/meta/compiler/meta/cli.lux index 28bc83c3b..156804e1a 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cli.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cli.lux @@ -40,6 +40,7 @@ libraries (random.list amount (random.lower_case 3)) target (random.lower_case 4) module (random.lower_case 5) + program (random.lower_case 6) compilers (random.list amount $/compiler.random) configuration ($configuration.random 5) .let [compilation' (all list#composite @@ -128,6 +129,7 @@ /.#sources sources /.#target target /.#module module + /.#program {.#Some program} /.#configuration configuration]}] [{/.#Interpretation [/.#host_dependencies host_dependencies /.#libraries libraries @@ -135,6 +137,7 @@ /.#sources sources /.#target target /.#module module + /.#program {.#Some program} /.#configuration configuration]}] [{/.#Export [sources target]}] ))))) diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index 1f31b3874..c2e473f46 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -91,58 +91,48 @@ (!expect {try.#Failure _})))) )))) -(def actual_program - (syntax (_ [actual_program (<| <code>.form - (<>.after (<code>.this_text "lux def program")) - <code>.any)]) - (in (list actual_program)))) - (def .public test Test (<| (_.covering /._) (do random.monad [inputs (random.list 5 (random.upper_case 5))] (all _.and - (_.coverage [/.program:] + (_.coverage [/.program] (let [(open "list#[0]") (list.equivalence text.equivalence)] - (and (with_expansions [<program> (/.program: all_arguments - (io.io all_arguments))] - (let [outcome ((is (-> (List Text) (io.IO Any)) - (..actual_program <program>)) - inputs)] - (same? (is Any inputs) - (io.run! outcome)))) - (with_expansions [<program> (/.program: [arg/0 \\parser.any - arg/1 \\parser.any - arg/2 \\parser.any - arg/3 \\parser.any - arg/4 \\parser.any] - (io.io (list arg/4 arg/3 arg/2 arg/1 arg/0)))] - (let [outcome ((is (-> (List Text) (io.IO Any)) - (..actual_program <program>)) - inputs)] - (list#= (list.reversed inputs) - (as (List Text) (io.run! outcome))))) - (with_expansions [<program> (/.program: [all_arguments (<>.many \\parser.any)] - (io.io all_arguments))] - (let [outcome ((is (-> (List Text) (io.IO Any)) - (..actual_program <program>)) - inputs)] - (list#= inputs - (as (List Text) (io.run! outcome))))) - (with_expansions [<program> (/.program: [arg/0 \\parser.any - arg/1 \\parser.any - arg/2 \\parser.any - arg/3 \\parser.any] - (io.io []))] - (case (try ((is (-> (List Text) (io.IO Any)) - (..actual_program <program>)) - inputs)) - {try.#Success _} - false - - {try.#Failure _} - true))))) + (and (let [outcome ((is /.Program + (/.program all_arguments + (io.io all_arguments))) + inputs)] + (same? (is Any inputs) + (io.run! outcome))) + (let [outcome ((is /.Program + (/.program [arg/0 \\parser.any + arg/1 \\parser.any + arg/2 \\parser.any + arg/3 \\parser.any + arg/4 \\parser.any] + (io.io (list arg/4 arg/3 arg/2 arg/1 arg/0)))) + inputs)] + (list#= (list.reversed inputs) + (as (List Text) (io.run! outcome)))) + (let [outcome ((is /.Program + (/.program [all_arguments (<>.many \\parser.any)] + (io.io all_arguments))) + inputs)] + (list#= inputs + (as (List Text) (io.run! outcome)))) + (case (try ((is /.Program + (/.program [arg/0 \\parser.any + arg/1 \\parser.any + arg/2 \\parser.any + arg/3 \\parser.any] + (io.io []))) + inputs)) + {try.#Success _} + false + + {try.#Failure _} + true)))) ..\\parser )))) |