From 022ada35548ef5e0e3b9614f9bb96de9d2137ced Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 10 May 2018 00:04:20 -0400 Subject: - Re-named "Compiler" type to "Lux". --- luxc/src/lux/analyser/lux.clj | 2 +- luxc/src/lux/base.clj | 28 ++++++++++------------ luxc/src/lux/compiler/cache.clj | 4 ++-- new-luxc/project.clj | 2 +- new-luxc/source/luxc/lang/init.lux | 2 +- new-luxc/source/luxc/lang/macro.lux | 2 +- new-luxc/source/luxc/lang/translation.lux | 8 +++---- .../luxc/lang/translation/js/imports.jvm.lux | 4 ++-- .../luxc/lang/translation/jvm/common.jvm.lux | 3 +-- .../luxc/lang/translation/jvm/imports.jvm.lux | 18 +++++++------- new-luxc/source/luxc/repl.lux | 8 +++---- new-luxc/test/test/luxc/common.lux | 6 ++--- stdlib/source/lux.lux | 24 +++++++++---------- stdlib/source/lux/host.jvm.lux | 4 ++-- stdlib/source/lux/macro.lux | 10 ++++---- stdlib/source/lux/macro/syntax.lux | 2 +- stdlib/source/lux/macro/syntax/common/reader.lux | 4 ++-- stdlib/source/lux/type/implicit.lux | 4 ++-- 18 files changed, 66 insertions(+), 69 deletions(-) diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj index 7debbde45..639d71cb6 100644 --- a/luxc/src/lux/analyser/lux.clj +++ b/luxc/src/lux/analyser/lux.clj @@ -596,7 +596,7 @@ old new)) (defn ^:private merge-compilers - "(-> Text Compiler Compiler Compiler)" + "(-> Text Lux Lux Lux)" [current-module new old] (->> old (&/set$ &/$modules (merge-modules current-module diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 25c331b94..8867d0b1e 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -129,7 +129,6 @@ "dummy-mappings" ]) -;; Compiler (defvariant ("Build" 0) ("Eval" 0) @@ -159,7 +158,6 @@ "extensions" "host"]) -;; Compiler (defvariant ("UpperBound" 0) ("LowerBound" 0)) @@ -785,7 +783,7 @@ (with-jvm-host-slot $writer (fn [_] ($Some writer)) body)) (defn with-type-env - "(All [a] (-> TypeEnv (Lux a) (Lux a)))" + "(All [a] (-> TypeEnv (Meta a) (Meta a)))" [type-env body] (with-jvm-host-slot $type-env (partial |++ type-env) body)) @@ -928,7 +926,7 @@ (return* state module-name)))) (defn find-module - "(-> Text (Lux (Module Compiler)))" + "(-> Text (Meta (Module Lux)))" [name] (fn [state] (if-let [module (|get name (get$ $modules state))] @@ -936,7 +934,7 @@ ((fail-with-loc (str "[Error] Unknown module: " name)) state)))) -(def ^{:doc "(Lux (Module Compiler))"} +(def ^{:doc "(Meta (Module Lux))"} get-current-module (|do [module-name get-module-name] (find-module module-name))) @@ -1014,7 +1012,7 @@ output))))) (defn with-expected-type - "(All [a] (-> Type (Lux a)))" + "(All [a] (-> Type (Meta a)))" [type body] (fn [state] (let [output (body (set$ $expected ($Some type) state))] @@ -1027,7 +1025,7 @@ output)))) (defn with-cursor - "(All [a] (-> Cursor (Lux a)))" + "(All [a] (-> Cursor (Meta a)))" [^objects cursor body] (|let [[_file-name _ _] cursor] (if (= "" _file-name) @@ -1043,7 +1041,7 @@ output)))))) (defn with-analysis-meta - "(All [a] (-> Cursor Type (Lux a)))" + "(All [a] (-> Cursor Type (Meta a)))" [^objects cursor type body] (|let [[_file-name _ _] cursor] (if (= "" _file-name) @@ -1072,7 +1070,7 @@ _ output)))))) -(def ^{:doc "(Lux Top)"} +(def ^{:doc "(Meta Top)"} ensure-statement (fn [state] (|case (get$ $expected state) @@ -1084,7 +1082,7 @@ state)))) (def cursor - ;; (Lux Cursor) + ;; (Meta Cursor) (fn [state] (return* state (get$ $cursor state)))) @@ -1321,13 +1319,13 @@ [xs] (enumerate* 0 xs)) -(def ^{:doc "(Lux (List Text))"} +(def ^{:doc "(Meta (List Text))"} modules (fn [state] (return* state (|keys (get$ $modules state))))) (defn when% - "(-> Bool (Lux Top) (Lux Top))" + "(-> Bool (Meta Top) (Meta Top))" [test body] (if test body @@ -1351,7 +1349,7 @@ $None)) (defn normalize - "(-> Ident (Lux Ident))" + "(-> Ident (Meta Ident))" [ident] (|case ident ["" name] (|do [module get-module-name] @@ -1392,14 +1390,14 @@ |any? false or) (defn m-comp - "(All [a b c] (-> (-> b (Lux c)) (-> a (Lux b)) (-> a (Lux c))))" + "(All [a b c] (-> (-> b (Meta c)) (-> a (Meta b)) (-> a (Meta c))))" [f g] (fn [x] (|do [y (g x)] (f y)))) (defn with-attempt - "(All [a] (-> (Lux a) (-> Text (Lux a)) (Lux a)))" + "(All [a] (-> (Meta a) (-> Text (Meta a)) (Meta a)))" [m-value on-error] (fn [state] (|case (m-value state) diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj index a0b2b0588..04ef34e52 100644 --- a/luxc/src/lux/compiler/cache.clj +++ b/luxc/src/lux/compiler/cache.clj @@ -49,7 +49,7 @@ (list* module))) (defn clean [state] - "(-> Compiler Null)" + "(-> Lux Null)" (let [needed-modules (->> state (&/get$ &/$modules) &/|keys &/->seq set) output-dir-prefix (str (.getAbsolutePath (new File ^String @&&core/!output-dir)) java.io.File/separator) outdated? #(->> % (contains? needed-modules) not) @@ -229,7 +229,7 @@ (return nil))) (defn ^:private inject-module - "(-> Module Compiler (Lux Null))" + "(-> Module Lux (Lux Null))" [module-name module] (fn [compiler] (return* (&/update$ &/$modules diff --git a/new-luxc/project.clj b/new-luxc/project.clj index 674fdc506..b92276a50 100644 --- a/new-luxc/project.clj +++ b/new-luxc/project.clj @@ -20,7 +20,7 @@ :dependencies [;; JVM Bytecode [org.ow2.asm/asm-all "5.0.3"] - ;; LUA + ;; Lua [net.sandius.rembulan/rembulan-runtime "0.1-SNAPSHOT"] [net.sandius.rembulan/rembulan-stdlib "0.1-SNAPSHOT"] [net.sandius.rembulan/rembulan-compiler "0.1-SNAPSHOT"] diff --git a/new-luxc/source/luxc/lang/init.lux b/new-luxc/source/luxc/lang/init.lux index 73b2baf0a..da8fc9c07 100644 --- a/new-luxc/source/luxc/lang/init.lux +++ b/new-luxc/source/luxc/lang/init.lux @@ -34,7 +34,7 @@ #.mode #.Build}) (def: #export (compiler host) - (-> Top Compiler) + (-> Top Lux) {#.info ..info #.source dummy-source #.cursor .dummy-cursor diff --git a/new-luxc/source/luxc/lang/macro.lux b/new-luxc/source/luxc/lang/macro.lux index cde3209fc..043f0df93 100644 --- a/new-luxc/source/luxc/lang/macro.lux +++ b/new-luxc/source/luxc/lang/macro.lux @@ -30,6 +30,6 @@ (host.array-write +0 (:! Object inputs)) (host.array-write +1 (:! Object compiler)))] apply-method)] - (:! (e.Error [Compiler (List Code)]) + (:! (e.Error [Lux (List Code)]) output)))))) }) diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index cd9214885..4cab6d682 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -67,7 +67,7 @@ (wrap [annsI (:! Code annsV)]))) (def: (switch-compiler new-compiler) - (-> Compiler (Meta Aliases)) + (-> Lux (Meta Aliases)) (function (_ old-compiler) ((do macro.Monad [this macro.current-module] @@ -75,7 +75,7 @@ new-compiler))) (def: #export (translate translate-module aliases code) - (-> (-> Text Compiler (Process Compiler)) Aliases Code (Meta Aliases)) + (-> (-> Text Lux (Process Lux)) Aliases Code (Meta Aliases)) (case code (^code ("lux module" (~ annsC))) (do macro.Monad @@ -184,7 +184,7 @@ (def: no-aliases Aliases (dict.new text.Hash)) (def: #export (translate-module source-dirs target-dir module-name compiler) - (-> (List File) File Text Compiler (Process Compiler)) + (-> (List File) File Text Lux (Process Lux)) (do io.Monad [[file-name file-content] (&io.read source-dirs module-name) #let [module-hash (text/hash file-content) @@ -241,7 +241,7 @@ )) (def: (initialize sources target) - (-> (List File) File (Process Compiler)) + (-> (List File) File (Process Lux)) (do io.Monad [compiler (case (runtimeT.translate ## (initL.compiler (io.run js.init)) (initL.compiler (io.run hostL.init-host)) diff --git a/new-luxc/source/luxc/lang/translation/js/imports.jvm.lux b/new-luxc/source/luxc/lang/translation/js/imports.jvm.lux index 64f10dabc..cbd4b2752 100644 --- a/new-luxc/source/luxc/lang/translation/js/imports.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/imports.jvm.lux @@ -30,9 +30,9 @@ (def: import (s.Syntax Import) (s.tuple (p.seq s.text s.text))) (def: #export (translate-imports translate-module annotations) - (-> (-> Text Compiler (Process Compiler)) + (-> (-> Text Lux (Process Lux)) Code - (Meta (Process Compiler))) + (Meta (Process Lux))) (do macro.Monad [_ (moduleL.set-annotations annotations) current-module macro.current-module-name diff --git a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux index 524433214..29db94d07 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux @@ -116,8 +116,7 @@ (def: #export $Object $.Type ($t.class "java.lang.Object" (list))) (def: #export (load-definition compiler) - (-> Compiler - (-> Ident Blob (Error Top))) + (-> Lux (-> Ident Blob (Error Top))) (function (_ (^@ def-ident [def-module def-name]) def-bytecode) (let [normal-name (format (lang.normalize-name def-name) (%n (text/hash def-name))) class-name (format (text.replace-all "/" "." def-module) "." normal-name)] diff --git a/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux index 44314fcf2..de75a4d75 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux @@ -45,7 +45,7 @@ (def: import (s.Syntax Import) (s.tuple (p.seq s.text s.text))) (def: compilations - (Var (Dict Text (CompletableFuture (Error Compiler)))) + (Var (Dict Text (CompletableFuture (Error Lux)))) (stm.var (dict.new text.Hash))) (def: (promise-to-future promise) @@ -61,12 +61,12 @@ (:: io.Monad map (|>> #e.Success))) (def: (translate-dependency translate-module dependency compiler) - (-> (-> Text Compiler (Process Compiler)) - (-> Text Compiler (IO (Future (Error Compiler))))) + (-> (-> Text Lux (Process Lux)) + (-> Text Lux (IO (Future (Error Lux))))) (<| (Future::get []) promise-to-future (do promise.Monad - [[new? future] (stm.commit (: (STM [Bool (CompletableFuture (Error Compiler))]) + [[new? future] (stm.commit (: (STM [Bool (CompletableFuture (Error Lux))]) (do stm.Monad [current-compilations (stm.read compilations)] (case (dict.get dependency current-compilations) @@ -75,7 +75,7 @@ #.None (do @ - [#let [pending (: (CompletableFuture (Error Compiler)) + [#let [pending (: (CompletableFuture (Error Lux)) (CompletableFuture::new []))] _ (stm.write (dict.put dependency pending current-compilations) compilations)] @@ -104,15 +104,15 @@ from-current))) (def: (merge-compilers current-module dependency total) - (-> Text Compiler Compiler Compiler) + (-> Text Lux Lux Lux) (|> total (update@ #.modules (merge-modules current-module (get@ #.modules dependency))) (set@ #.seed (get@ #.seed dependency)))) (def: #export (translate-imports translate-module annotations) - (-> (-> Text Compiler (Process Compiler)) + (-> (-> Text Lux (Process Lux)) Code - (Meta (Process Compiler))) + (Meta (Process Lux))) (do macro.Monad [_ (moduleL.set-annotations annotations) current-module macro.current-module-name @@ -124,7 +124,7 @@ (#e.Error error) (&.throw Invalid-Imports (%code (code.tuple imports))))) - dependencies (monad.map @ (: (-> [Text Text] (Meta (IO (Future (Error Compiler))))) + dependencies (monad.map @ (: (-> [Text Text] (Meta (IO (Future (Error Lux))))) (function (_ [dependency alias]) (do @ [_ (&.assert Module-Cannot-Import-Itself current-module diff --git a/new-luxc/source/luxc/repl.lux b/new-luxc/source/luxc/repl.lux index cdc61ab22..fbf1a336e 100644 --- a/new-luxc/source/luxc/repl.lux +++ b/new-luxc/source/luxc/repl.lux @@ -55,7 +55,7 @@ (def: no-aliases Aliases (dict.new text.Hash)) (def: (initialize source-dirs target-dir console) - (-> (List File) File Console (Task Compiler)) + (-> (List File) File Console (Task Lux)) (do promise.Monad [output (promise.future (do io.Monad @@ -200,7 +200,7 @@ (recur tail variantV))))))))) (def: (tagged-representation compiler representation) - (-> Compiler (Poly Representation) (Poly Representation)) + (-> Lux (Poly Representation) (Poly Representation)) (do p.Monad [[name anonymous] poly.named] (case (macro.run compiler (macro.tags-of name)) @@ -237,7 +237,7 @@ (format "[" tuple-body "]")))))) (def: (representation compiler) - (-> Compiler (Poly Representation)) + (-> Lux (Poly Representation)) (p.rec (function (_ representation) ($_ p.either @@ -263,7 +263,7 @@ )))) (def: (represent compiler type value) - (-> Compiler Type Top Text) + (-> Lux Type Top Text) (case (poly.run type (representation compiler)) (#e.Success representation) (representation value) diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index b5754b088..01e3d1aaa 100644 --- a/new-luxc/test/test/luxc/common.lux +++ b/new-luxc/test/test/luxc/common.lux @@ -61,7 +61,7 @@ (do-template [ ] [(def: #export - (IO Compiler) + (IO Lux) (do io.Monad [host ] (wrap (initL.compiler host))))] @@ -78,7 +78,7 @@ ) (def: (runner translate-runtime translate-expression eval init) - (All [a] (-> (Meta Top) (-> Synthesis (Meta a)) (-> a (Meta Top)) (IO Compiler) + (All [a] (-> (Meta Top) (-> Synthesis (Meta a)) (-> a (Meta Top)) (IO Lux) Runner)) (function (_ synthesis) (|> (do macro.Monad @@ -89,7 +89,7 @@ (macro.run (io.run init))))) (def: (definer translate-runtime translate-expression eval init translate-def) - (All [a] (-> (Meta Top) (-> Synthesis (Meta a)) (-> a (Meta Top)) (IO Compiler) + (All [a] (-> (Meta Top) (-> Synthesis (Meta a)) (-> a (Meta Top)) (IO Lux) (-> Text Type a Code (Meta Top)) Definer)) (function (_ [module-name def-name] synthesis) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 6270d0b47..9537f6a9b 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -676,7 +676,7 @@ (text$ "Information about the current version and type of compiler that is running.")] default-def-meta-exported)))) -## (type: Compiler +## (type: Lux ## {#info Info ## #source Source ## #cursor Cursor @@ -689,8 +689,8 @@ ## #scope-type-vars (List Nat) ## #extensions Bottom ## #host Bottom}) -("lux def" Compiler - (#Named ["lux" "Compiler"] +("lux def" Lux + (#Named ["lux" "Lux"] (#Product ## "lux.info" Info (#Product ## "lux.source" @@ -738,12 +738,12 @@ default-def-meta-exported)))) ## (type: (Meta a) -## (-> Compiler (Either Text [Compiler a]))) +## (-> Lux (Either Text [Lux a]))) ("lux def" Meta (#Named ["lux" "Meta"] (#UnivQ #Nil - (#Function Compiler - (#Apply (#Product Compiler (#Bound +1)) + (#Function Lux + (#Apply (#Product Lux (#Bound +1)) (#Apply Text Either))))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "Computations that can have access to the state of the compiler. @@ -766,8 +766,8 @@ ("lux def" return ("lux check" (#UnivQ #Nil (#Function (#Bound +1) - (#Function Compiler - (#Apply (#Product Compiler + (#Function Lux + (#Apply (#Product Lux (#Bound +1)) (#Apply Text Either))))) ("lux function" _ val @@ -778,8 +778,8 @@ ("lux def" fail ("lux check" (#UnivQ #Nil (#Function Text - (#Function Compiler - (#Apply (#Product Compiler + (#Function Lux + (#Apply (#Product Lux (#Bound +1)) (#Apply Text Either))))) ("lux function" _ msg @@ -4436,7 +4436,7 @@ (#Some y) (#Some y))) (def: (find-in-env name state) - (-> Text Compiler (Maybe Type)) + (-> Text Lux (Maybe Type)) (case state {#info info #source source #current-module _ #modules modules #scopes scopes #type-context types #host host @@ -4459,7 +4459,7 @@ scopes))) (def: (find-def-type name state) - (-> Ident Compiler (Maybe Type)) + (-> Ident Lux (Maybe Type)) (let [[v-prefix v-name] name {#info info #source source #current-module _ #modules modules #scopes scopes #type-context types #host host diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 2315ffd2c..1f920c0b1 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -358,7 +358,7 @@ (#.Cons short+full imports)) (def: (class-imports compiler) - (-> Compiler Class-Imports) + (-> Lux Class-Imports) (case (macro.run compiler (: (Meta Class-Imports) (do Monad @@ -2055,7 +2055,7 @@ (wrap (list (` ("jvm object class" (~ (code.text (simple-class$ (list) type)))))))) (def: get-compiler - (Meta Compiler) + (Meta Lux) (function (_ compiler) (#.Right [compiler compiler]))) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 9b2b5fac8..1328fc034 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -14,7 +14,7 @@ (/ [code])) ## (type: (Meta a) -## (-> Compiler (e.Error [Compiler a]))) +## (-> Lux (e.Error [Lux a]))) (struct: #export _ (Functor Meta) (def: (map f fa) @@ -72,11 +72,11 @@ (get k plist')))) (def: #export (run' compiler action) - (All [a] (-> Compiler (Meta a) (e.Error [Compiler a]))) + (All [a] (-> Lux (Meta a) (e.Error [Lux a]))) (action compiler)) (def: #export (run compiler action) - (All [a] (-> Compiler (Meta a) (e.Error a))) + (All [a] (-> Lux (Meta a) (e.Error a))) (case (action compiler) (#e.Error error) (#e.Error error) @@ -531,7 +531,7 @@ (find-def-type name)))) (def: #export (find-type-def name) - {#.doc "Finds the value of a type definition (such as Int, Top or Compiler)."} + {#.doc "Finds the value of a type definition (such as Int, Top or Lux)."} (-> Ident (Meta Type)) (do Monad [[def-type def-data def-value] (find-def name)] @@ -660,7 +660,7 @@ (def: #export get-compiler {#.doc "Obtains the current state of the compiler."} - (Meta Compiler) + (Meta Lux) (function (_ compiler) (#e.Success [compiler compiler]))) diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 807e3a2b7..0907d3d81 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -159,7 +159,7 @@ (def: #export (on compiler action) {#.doc "Run a Lux operation as if it was a Syntax parser."} - (All [a] (-> Compiler (Meta a) (Syntax a))) + (All [a] (-> Lux (Meta a) (Syntax a))) (function (_ input) (case (macro.run compiler action) (#e.Error error) diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index 360abd685..49ef3851d 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -101,7 +101,7 @@ (def: #export (definition compiler) {#.doc "A reader that first macro-expands and then analyses the input Code, to ensure it's a definition."} - (-> Compiler (Syntax //.Definition)) + (-> Lux (Syntax //.Definition)) (do p.Monad [definition-raw s.any me-definition-raw (s.on compiler @@ -123,7 +123,7 @@ (def: #export (typed-definition compiler) {#.doc "A reader for definitions that ensures the input syntax is typed."} - (-> Compiler (Syntax //.Definition)) + (-> Lux (Syntax //.Definition)) (do p.Monad [_definition (definition compiler) _ (case (get@ #//.definition-type _definition) diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index 40ccde862..0decd9dba 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -196,7 +196,7 @@ #dependencies (List Instance)}) (def: (test-provision provision context dep alts) - (-> (-> Compiler Type-Context Type (Check Instance)) + (-> (-> Lux Type-Context Type (Check Instance)) Type-Context Type (List [Ident Type]) (Meta (List Instance))) (do Monad @@ -224,7 +224,7 @@ (wrap found)))) (def: (provision compiler context dep) - (-> Compiler Type-Context Type (Check Instance)) + (-> Lux Type-Context Type (Check Instance)) (case (macro.run compiler ($_ macro.either (do Monad [alts local-env] (test-provision provision context dep alts)) -- cgit v1.2.3