diff options
author | Eduardo Julian | 2015-07-24 23:09:26 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-07-24 23:09:26 -0400 |
commit | 23b51269d8d0e1d756d019a6bf28ec24b6a507e1 (patch) | |
tree | 9a754fef14c5da13a486f37f17e6ec395bed846e /input | |
parent | 1fd2fc0ff67f76177d4addc13faae5d0e95773d3 (diff) |
- Removed the "seen-sources" field from the compiler state.
- Fixed the caching mechanism.
Diffstat (limited to '')
-rw-r--r-- | input/lux.lux | 36 | ||||
-rw-r--r-- | input/lux/meta/lux.lux | 6 |
2 files changed, 22 insertions, 20 deletions
diff --git a/input/lux.lux b/input/lux.lux index 7ba6cef76..3bd4d58d0 100644 --- a/input/lux.lux +++ b/input/lux.lux @@ -267,7 +267,6 @@ ## #types (Bindings Int Type) ## #host HostState ## #seed Int -## #seen-sources (List Text) ## #eval? Bool)) (_lux_def Compiler (#AppT [(#AllT [(#Some #Nil) "lux;Compiler" "" @@ -280,9 +279,8 @@ (#Cons [["lux;types" (#AppT [(#AppT [Bindings Int]) Type])] (#Cons [["lux;host" HostState] (#Cons [["lux;seed" Int] - (#Cons [["lux;seen-sources" (#AppT [List Text])] - (#Cons [["lux;eval?" Bool] - #Nil])])])])])])])]))]) + (#Cons [["lux;eval?" Bool] + #Nil])])])])])])]))]) Void])) (_lux_export Compiler) @@ -1299,7 +1297,7 @@ (_lux_case state {#source source #modules modules #envs envs #types types #host host - #seed seed #seen-sources seen-sources #eval? eval?} + #seed seed #eval? eval?} (_lux_case (reverse envs) #Nil (#Left "Can't get the module name without a module!") @@ -1338,7 +1336,7 @@ (_lux_case state {#source source #modules modules #envs envs #types types #host host - #seed seed #seen-sources seen-sources #eval? eval?} + #seed seed #eval? eval?} (#Right [state (find-macro' modules current-module module name)])))))) (def'' (list:join xs) @@ -1396,7 +1394,7 @@ (as-pairs tokens))] (;return (list (`' (#;RecordT (~ (untemplate-list pairs))))))))) -(def'' (->text x) +(def'' #export (->text x) (-> (^ java.lang.Object) Text) (_jvm_invokevirtual java.lang.Object toString [] x [])) @@ -1735,10 +1733,10 @@ (case state {#source source #modules modules #envs envs #types types #host host - #seed seed #seen-sources seen-sources #eval? eval?} + #seed seed #eval? eval?} (#Right [{#source source #modules modules #envs envs #types types #host host - #seed (inc seed) #seen-sources seen-sources #eval? eval?} + #seed (inc seed) #eval? eval?} (symbol$ ["__gensym__" (->text seed)])]))) (def (macro-expand-1 token) @@ -1986,7 +1984,7 @@ (case state {#source source #modules modules #envs envs #types types #host host - #seed seed #seen-sources seen-sources #eval? eval?} + #seed seed #eval? eval?} (case (get module modules) (#Some =module) (#Right [state true]) @@ -2000,7 +1998,7 @@ (case state {#source source #modules modules #envs envs #types types #host host - #seed seed #seen-sources seen-sources #eval? eval?} + #seed seed #eval? eval?} (case (get module modules) (#Some =module) (let [to-alias (map (: (-> (, Text (, Bool (DefData' (-> (List Syntax) (StateE Compiler (List Syntax)))))) @@ -2190,9 +2188,13 @@ _ (;return (: (List Syntax) (list:++ (map (lambda [m-name] - (` (_lux_import (~ (text$ m-name))))) + (exec (_jvm_invokevirtual java.io.PrintStream print [java.lang.Object] + (_jvm_getstatic java.lang.System out) [($ text:++ "lux;import " m-name "\n")]) + (` (_lux_import (~ (text$ m-name)))))) unknowns) - (list (` (import (~@ tokens)))))))))) + (exec (_jvm_invokevirtual java.io.PrintStream print [java.lang.Object] + (_jvm_getstatic java.lang.System out) ["\n"]) + (list (` (import (~@ tokens))))))))))) (def (some f xs) (All [a b] @@ -2399,7 +2401,7 @@ (case state {#source source #modules modules #envs envs #types types #host host - #seed seed #seen-sources seen-sources #eval? eval?} + #seed seed #eval? eval?} (some (: (-> (Env Text (, LuxVar Type)) (Maybe Type)) (lambda [env] (case env @@ -2449,7 +2451,7 @@ (let [[v-prefix v-name] name {#source source #modules modules #envs envs #types types #host host - #seed seed #seen-sources seen-sources #eval? eval?} state] + #seed seed #eval? eval?} state] (case (get v-prefix modules) #None #None @@ -2472,7 +2474,7 @@ ## (let [[v-prefix v-name] name ## {#source source #modules modules ## #envs envs #types types #host host -## #seed seed #seen-sources seen-sources #eval? eval?} state] +## #seed seed #eval? eval?} state] ## (do Maybe/Monad ## [module (get v-prefix modules) ## #let [{#defs defs #module-aliases _ #imports _} module] @@ -2501,7 +2503,7 @@ _ (let [{#source source #modules modules #envs envs #types types #host host - #seed seed #seen-sources seen-sources #eval? eval?} state] + #seed seed #eval? eval?} state] (#Left ($ text:++ "Unknown var: " (ident->text name) "\n\n" (show-envs envs))))))))) (defmacro #export (using tokens) diff --git a/input/lux/meta/lux.lux b/input/lux/meta/lux.lux index db3c700e6..a28d6e5d4 100644 --- a/input/lux/meta/lux.lux +++ b/input/lux/meta/lux.lux @@ -227,7 +227,7 @@ (case state {#;source source #;modules modules #;envs envs #;types types #;host host - #;seed seed #;seen-sources seen-sources #;eval? eval?} + #;seed seed #;eval? eval?} (some (: (-> (Env Text (, LuxVar Type)) (Maybe Type)) (lambda [env] (case env @@ -247,7 +247,7 @@ (let [[v-prefix v-name] name {#;source source #;modules modules #;envs envs #;types types #;host host - #;seed seed #;seen-sources seen-sources #;eval? eval?} state] + #;seed seed #;eval? eval?} state] (case (get v-prefix modules) #;None #;None @@ -282,6 +282,6 @@ _ (let [{#;source source #;modules modules #;envs envs #;types types #;host host - #;seed seed #;seen-sources seen-sources #;eval? eval?} state] + #;seed seed #;eval? eval?} state] (#;Left ($ text:++ "Unknown var: " (ident->text name) "\n\n" (show-envs envs)))))))) )) |