diff options
Diffstat (limited to '')
15 files changed, 106 insertions, 110 deletions
diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 5b11a8e39..85eed9ba1 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -12,14 +12,13 @@ [host] [io] (world [file #+ File])) - (luxc ["&" base] - [";L" host] - (host [";H" macro] - ["$" jvm]) + (luxc ["&" lang] ["&;" io] - ["&;" module] - ["&;" eval] - (lang ["&;" syntax] + (lang [";L" module] + [";L" host] + (host [";H" macro] + ["$" jvm]) + ["&;" syntax] (analysis [";A" expression] [";A" common]) (synthesis [";S" expression]) @@ -27,7 +26,8 @@ [";T" statement] [";T" common] [";T" expression] - [";T" eval])) + [";T" eval]) + ["&;" eval]) )) (def: analyse @@ -160,7 +160,7 @@ [#let [init-cursor [file-name +1 +0]] output (&;with-source-code [init-cursor +0 source-code] action) - _ (&module;flag-compiled! module-name)] + _ (moduleL;flag-compiled! module-name)] (wrap output))) (def: (parse current-module) @@ -174,15 +174,15 @@ (#e;Success [(set@ #;source source' compiler) output])))) -(def: (translate-module source-dirs module-name target-dir compiler) - (-> (List File) Text File Compiler (T;Task Compiler)) +(def: (translate-module source-dirs target-dir module-name compiler) + (-> (List File) File Text Compiler (T;Task Compiler)) (do T;Monad<Task> [_ (&io;prepare-module target-dir module-name) [file-name file-content] (&io;read-module source-dirs module-name) #let [module-hash (text/hash file-content)]] (case (meta;run' compiler (do meta;Monad<Meta> - [[_ artifacts _] (&module;with-module module-hash module-name + [[_ artifacts _] (moduleL;with-module module-hash module-name (commonT;with-artifacts (with-active-compilation [module-name file-name @@ -193,14 +193,10 @@ #let [[cursor _] code]] (&;with-cursor cursor (translate code)))))))] - (wrap artifacts) - ## (&module;translate-descriptor module-name) - )) - (#e;Success [compiler artifacts ## module-descriptor - ]) + (wrap artifacts))) + (#e;Success [compiler artifacts]) (do @ - [## _ (&io;write-module module-name module-descriptor) - _ (monad;map @ (function [[class-name class-bytecode]] + [_ (monad;map @ (function [[class-name class-bytecode]] (&io;write-file target-dir class-name class-bytecode)) (dict;entries artifacts))] (wrap compiler)) @@ -236,8 +232,8 @@ #;scope-type-vars (list) #;host (:! Void host)}) -(def: #export (translate-program program target sources) - (-> Text File (List File) (T;Task Unit)) +(def: #export (translate-program sources target program) + (-> (List File) File Text (T;Task Unit)) (do T;Monad<Task> [compiler (|> (case (runtimeT;translate (init-compiler (io;run hostL;init-host))) (#e;Error error) @@ -250,7 +246,7 @@ _ (&io;write-file target hostL;function-class function-bc)] (wrap compiler))) (: (T;Task Compiler)) - (:: @ map (translate-module sources prelude target)) (:: @ join) - (:: @ map (translate-module sources program target)) (:: @ join)) + (:: @ map (translate-module sources target prelude)) (:: @ join) + (:: @ map (translate-module sources target program)) (:: @ join)) #let [_ (log! "Compilation complete!")]] (wrap []))) diff --git a/new-luxc/source/luxc/lang/translation/case.jvm.lux b/new-luxc/source/luxc/lang/translation/case.jvm.lux index cb0aa2198..e3052c77d 100644 --- a/new-luxc/source/luxc/lang/translation/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/case.jvm.lux @@ -4,12 +4,12 @@ ["ex" exception #+ exception:]) (data text/format) [meta "meta/" Monad<Meta>]) - (luxc ["_" base] - [";L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$i" inst])) - (lang ["ls" synthesis])) + (luxc ["_" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$t" type] + ["$i" inst])) + ["ls" synthesis])) [../runtime]) (def: $Object $;Type ($t;class "java.lang.Object" (list))) diff --git a/new-luxc/source/luxc/lang/translation/common.jvm.lux b/new-luxc/source/luxc/lang/translation/common.jvm.lux index 4ec487d86..49e135709 100644 --- a/new-luxc/source/luxc/lang/translation/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common.jvm.lux @@ -10,11 +10,11 @@ [host] (world [blob #+ Blob] [file #+ File])) - (luxc (lang [";L" variable #+ Register]) - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])))) + (luxc (lang [";L" variable #+ Register] + (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst]))))) (host;import org.objectweb.asm.Opcodes (#static V1_6 int)) diff --git a/new-luxc/source/luxc/lang/translation/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/eval.jvm.lux index 9514741f8..3c4eea048 100644 --- a/new-luxc/source/luxc/lang/translation/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/eval.jvm.lux @@ -4,12 +4,12 @@ (data text/format) [meta] [host #+ do-to]) - (luxc ["&" base] - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])) - (lang ["la" analysis] + (luxc ["&" lang] + (lang (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst])) + ["la" analysis] ["ls" synthesis] (translation [";T" common])) )) diff --git a/new-luxc/source/luxc/lang/translation/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/expression.jvm.lux index fa5f54647..d592c5001 100644 --- a/new-luxc/source/luxc/lang/translation/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/expression.jvm.lux @@ -7,9 +7,10 @@ text/format) [meta] (meta ["s" syntax])) - (luxc ["&" base] - (host ["$" jvm]) - (lang ["ls" synthesis] + (luxc ["&" lang] + (lang [";L" variable #+ Variable Register] + (host ["$" jvm]) + ["ls" synthesis] (translation [";T" common] [";T" primitive] [";T" structure] @@ -17,8 +18,7 @@ [";T" procedure] [";T" function] [";T" reference] - [";T" case]) - [";L" variable #+ Variable Register]))) + [";T" case])))) (exception: #export Unrecognized-Synthesis) diff --git a/new-luxc/source/luxc/lang/translation/function.jvm.lux b/new-luxc/source/luxc/lang/translation/function.jvm.lux index 0247b3d7f..d12eca16e 100644 --- a/new-luxc/source/luxc/lang/translation/function.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/function.jvm.lux @@ -5,13 +5,13 @@ text/format (coll [list "list/" Functor<List> Monoid<List>])) [meta]) - (luxc ["&" base] - [";L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])) - (lang ["la" analysis] + (luxc ["&" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst])) + ["la" analysis] ["ls" synthesis] (translation [";T" common] [";T" runtime] diff --git a/new-luxc/source/luxc/lang/translation/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/loop.jvm.lux index 6e51d7eed..b5497236f 100644 --- a/new-luxc/source/luxc/lang/translation/loop.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/loop.jvm.lux @@ -5,13 +5,13 @@ text/format (coll [list "list/" Functor<List> Monoid<List>])) [meta]) - (luxc ["&" base] - [";L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])) - (lang ["la" analysis] + (luxc ["&" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst])) + ["la" analysis] ["ls" synthesis] (translation [";T" common] [";T" runtime] diff --git a/new-luxc/source/luxc/lang/translation/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/primitive.jvm.lux index f795a2980..f059aa8da 100644 --- a/new-luxc/source/luxc/lang/translation/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/primitive.jvm.lux @@ -3,12 +3,12 @@ (lux (control monad) (data text/format) [meta "meta/" Monad<Meta>]) - (luxc ["&" base] - [";L" host] - (host ["$" jvm] - (jvm ["$i" inst] - ["$t" type])) - (lang ["la" analysis] + (luxc ["&" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$i" inst] + ["$t" type])) + ["la" analysis] ["ls" synthesis] (translation [";T" common]))) [../runtime]) diff --git a/new-luxc/source/luxc/lang/translation/procedure.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure.jvm.lux index 733f630d5..917edd78d 100644 --- a/new-luxc/source/luxc/lang/translation/procedure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure.jvm.lux @@ -5,9 +5,9 @@ (data [maybe] text/format (coll [dict]))) - (luxc ["&" base] - (host ["$" jvm]) - (lang ["ls" synthesis])) + (luxc ["&" lang] + (lang (host ["$" jvm]) + ["ls" synthesis])) (. ["./;" common] ["./;" host])) diff --git a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux index 9a01622ae..3cab88e48 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux @@ -12,13 +12,13 @@ (meta [code] ["s" syntax #+ syntax:]) [host]) - (luxc ["&" base] - [";L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])) - (lang ["la" analysis] + (luxc ["&" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst])) + ["la" analysis] ["ls" synthesis] (translation [";T" runtime] [";T" case] diff --git a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux index e45c0b911..8a28e3cf7 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux @@ -14,13 +14,13 @@ (meta [code] ["s" syntax #+ syntax:]) [host]) - (luxc ["&" base] - [";L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])) - (lang ["la" analysis] + (luxc ["&" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst])) + ["la" analysis] (analysis (procedure ["&;" host])) ["ls" synthesis])) ["@" ../common]) diff --git a/new-luxc/source/luxc/lang/translation/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/reference.jvm.lux index e9c445dd4..b714558b8 100644 --- a/new-luxc/source/luxc/lang/translation/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/reference.jvm.lux @@ -4,12 +4,12 @@ (data [text "text/" Hash<Text>] text/format) [meta "meta/" Monad<Meta>]) - (luxc ["&" base] - [";L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$i" inst])) - (lang ["ls" synthesis] + (luxc ["&" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$t" type] + ["$i" inst])) + ["ls" synthesis] [";L" variable #+ Variable] (translation [";T" common])))) diff --git a/new-luxc/source/luxc/lang/translation/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/runtime.jvm.lux index 70450be91..fa6d6dcad 100644 --- a/new-luxc/source/luxc/lang/translation/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/runtime.jvm.lux @@ -6,13 +6,13 @@ [math] [meta] [host]) - (luxc ["&" base] - [";L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])) - (lang ["la" analysis] + (luxc ["&" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst])) + ["la" analysis] ["ls" synthesis] (translation [";T" common])))) diff --git a/new-luxc/source/luxc/lang/translation/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/statement.jvm.lux index 718175df1..232519d8b 100644 --- a/new-luxc/source/luxc/lang/translation/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/statement.jvm.lux @@ -9,15 +9,15 @@ (coll [list "list/" Functor<List> Fold<List>])) [meta] [host]) - (luxc ["&" base] - ["&;" scope] - ["&;" module] + (luxc ["&" lang] ["&;" io] - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])) - (lang (translation [";T" eval] + (lang (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst])) + ["&;" scope] + ["&;" module] + (translation [";T" eval] [";T" common])))) (exception: #export Invalid-Definition-Value) diff --git a/new-luxc/source/luxc/lang/translation/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/structure.jvm.lux index 68219b87c..2c04eaa0c 100644 --- a/new-luxc/source/luxc/lang/translation/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/structure.jvm.lux @@ -6,13 +6,13 @@ (coll [list])) [meta] [host #+ do-to]) - (luxc ["&" base] - [";L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$d" def] - ["$i" inst])) - (lang ["la" analysis] + (luxc ["&" lang] + (lang [";L" host] + (host ["$" jvm] + (jvm ["$t" type] + ["$d" def] + ["$i" inst])) + ["la" analysis] ["ls" synthesis] (translation [";T" common]))) [../runtime]) |