diff options
author | Eduardo Julian | 2017-10-31 23:39:49 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-31 23:39:49 -0400 |
commit | 15121222d570f8fe3c5a326208e4f0bad737e63c (patch) | |
tree | 88c93ed1f4965fd0e80677df5553a0d47e521963 /new-luxc/source/luxc | |
parent | a269ea72337852e8e57bd427773baed111ad6e92 (diff) |
- Re-organized analysis.
Diffstat (limited to '')
24 files changed, 62 insertions, 70 deletions
diff --git a/new-luxc/source/luxc/eval.lux b/new-luxc/source/luxc/eval.lux index 91195fbfd..fdbf8e781 100644 --- a/new-luxc/source/luxc/eval.lux +++ b/new-luxc/source/luxc/eval.lux @@ -2,9 +2,9 @@ lux (lux (control [monad #+ do]) [meta]) + (luxc (lang (analysis [";A" expression]))) [../base] - (.. [analyser] - [synthesizer] + (.. [synthesizer] (generator [";G" expression] [eval]))) @@ -12,7 +12,7 @@ ../base;Eval (do meta;Monad<Meta> [exprA (../base;with-expected-type type - (analyser;analyser eval exprC)) + (expressionA;analyser eval exprC)) #let [exprS (synthesizer;synthesize exprA)] exprI (expressionG;generate exprS)] (eval;eval exprI))) diff --git a/new-luxc/source/luxc/generator.lux b/new-luxc/source/luxc/generator.lux index 90e0ca4cf..b1068c257 100644 --- a/new-luxc/source/luxc/generator.lux +++ b/new-luxc/source/luxc/generator.lux @@ -14,11 +14,11 @@ [";L" host] ["&;" io] ["&;" module] - ["&;" parser] - ["&;" analyser] - ["&;" analyser/common] ["&;" synthesizer] ["&;" eval] + (lang ["&;" parser] + (analysis [";A" expression] + [";A" common])) (generator ["&&;" runtime] ["&&;" statement] ["&&;" common] @@ -28,7 +28,7 @@ (def: analyse (&;Analyser) - (&analyser;analyser &eval;eval)) + (expressionA;analyser &eval;eval)) (def: (generate code) (-> Code (Meta Unit)) @@ -49,7 +49,7 @@ (do @ [valueA (analyse valueC)] (wrap [Type valueA]))) - (&analyser/common;with-unknown-type + (commonA;with-unknown-type (analyse valueC)))) valueI (expressionG;generate (&synthesizer;synthesize valueA)) _ (&;with-scope diff --git a/new-luxc/source/luxc/generator/eval.jvm.lux b/new-luxc/source/luxc/generator/eval.jvm.lux index 3cf5fb189..86bede8cd 100644 --- a/new-luxc/source/luxc/generator/eval.jvm.lux +++ b/new-luxc/source/luxc/generator/eval.jvm.lux @@ -12,7 +12,6 @@ ["$i" inst])) (lang ["la" analysis] ["ls" synthesis]) - ["&;" analyser] ["&;" synthesizer] (generator ["&;" common]) )) diff --git a/new-luxc/source/luxc/generator/expression.jvm.lux b/new-luxc/source/luxc/generator/expression.jvm.lux index 5eb8d7c47..e0f95b48b 100644 --- a/new-luxc/source/luxc/generator/expression.jvm.lux +++ b/new-luxc/source/luxc/generator/expression.jvm.lux @@ -11,7 +11,6 @@ (host ["$" jvm]) (lang ["ls" synthesis] [";L" variable #+ Variable Register]) - ["&;" analyser] ["&;" synthesizer] (generator ["&;" common] ["&;" primitive] diff --git a/new-luxc/source/luxc/generator/function.jvm.lux b/new-luxc/source/luxc/generator/function.jvm.lux index ed90d3aa2..70b892d41 100644 --- a/new-luxc/source/luxc/generator/function.jvm.lux +++ b/new-luxc/source/luxc/generator/function.jvm.lux @@ -13,7 +13,6 @@ (lang ["la" analysis] ["ls" synthesis] [";L" variable #+ Variable]) - ["&;" analyser] ["&;" synthesizer] (generator ["&;" common] ["&;" runtime]))) diff --git a/new-luxc/source/luxc/generator/primitive.jvm.lux b/new-luxc/source/luxc/generator/primitive.jvm.lux index 2e4eb7ccf..f772383d1 100644 --- a/new-luxc/source/luxc/generator/primitive.jvm.lux +++ b/new-luxc/source/luxc/generator/primitive.jvm.lux @@ -10,7 +10,6 @@ ["$t" type])) (lang ["la" analysis] ["ls" synthesis]) - ["&;" analyser] ["&;" synthesizer] (generator ["&;" common])) [../runtime]) diff --git a/new-luxc/source/luxc/generator/procedure/common.jvm.lux b/new-luxc/source/luxc/generator/procedure/common.jvm.lux index a61b7f0fe..a8fa81f81 100644 --- a/new-luxc/source/luxc/generator/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/generator/procedure/common.jvm.lux @@ -17,7 +17,6 @@ ["$i" inst])) (lang ["la" analysis] ["ls" synthesis]) - ["&;" analyser] ["&;" synthesizer] (generator ["&;" common] ["&;" runtime]))) diff --git a/new-luxc/source/luxc/generator/procedure/host.jvm.lux b/new-luxc/source/luxc/generator/procedure/host.jvm.lux index bc57d6a2b..97c8fb87e 100644 --- a/new-luxc/source/luxc/generator/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/generator/procedure/host.jvm.lux @@ -21,9 +21,8 @@ ["$d" def] ["$i" inst])) (lang ["la" analysis] + (analysis (procedure ["&;" host])) ["ls" synthesis]) - ["&;" analyser] - (analyser (procedure ["&;" host])) ["&;" synthesizer] (generator ["&;" common] ["&;" runtime])) diff --git a/new-luxc/source/luxc/generator/runtime.jvm.lux b/new-luxc/source/luxc/generator/runtime.jvm.lux index c5777b4af..fd8fbf74a 100644 --- a/new-luxc/source/luxc/generator/runtime.jvm.lux +++ b/new-luxc/source/luxc/generator/runtime.jvm.lux @@ -14,7 +14,6 @@ ["$i" inst])) (lang ["la" analysis] ["ls" synthesis]) - ["&;" analyser] ["&;" synthesizer] (generator ["&;" common]))) diff --git a/new-luxc/source/luxc/generator/structure.jvm.lux b/new-luxc/source/luxc/generator/structure.jvm.lux index 33cc7936c..b9dced077 100644 --- a/new-luxc/source/luxc/generator/structure.jvm.lux +++ b/new-luxc/source/luxc/generator/structure.jvm.lux @@ -13,7 +13,6 @@ ["$i" inst])) (lang ["la" analysis] ["ls" synthesis]) - ["&;" analyser] ["&;" synthesizer] (generator ["&;" common])) [../runtime]) diff --git a/new-luxc/source/luxc/analyser/case.lux b/new-luxc/source/luxc/lang/analysis/case.lux index 29256865a..1e40e38f1 100644 --- a/new-luxc/source/luxc/analyser/case.lux +++ b/new-luxc/source/luxc/lang/analysis/case.lux @@ -15,12 +15,12 @@ (meta [code] [type] (type ["tc" check]))) - (../.. ["&" base] - (lang ["la" analysis]) - ["&;" scope]) - (.. ["&;" common] - ["&;" structure]) - (. ["&&;" coverage])) + (luxc ["&" base] + (lang ["la" analysis] + (analysis [";A" common] + [";A" structure] + (case [";A" coverage]))) + ["&;" scope])) (exception: #export Cannot-Match-Type-With-Pattern) (exception: #export Sum-Type-Has-No-Case) @@ -175,8 +175,8 @@ [cursor (#;Record record)] (do meta;Monad<Meta> - [record (&structure;normalize record) - [members recordT] (&structure;order record) + [record (structureA;normalize record) + [members recordT] (structureA;order record) _ (&;with-type-env (tc;check inputT recordT))] (analyse-pattern (#;Some (list;size members)) inputT [cursor (#;Tuple members)] next)) @@ -240,18 +240,18 @@ (#;Cons [patternH bodyH] branchesT) (do meta;Monad<Meta> - [[inputT inputA] (&common;with-unknown-type + [[inputT inputA] (commonA;with-unknown-type (analyse inputC)) outputH (analyse-pattern #;None inputT patternH (analyse bodyH)) outputT (monad;map @ (function [[patternT bodyT]] (analyse-pattern #;None inputT patternT (analyse bodyT))) branchesT) - outputHC (|> outputH product;left &&coverage;determine) - outputTC (monad;map @ (|>. product;left &&coverage;determine) outputT) - _ (case (monad;fold e;Monad<Error> &&coverage;merge outputHC outputTC) + outputHC (|> outputH product;left coverageA;determine) + outputTC (monad;map @ (|>. product;left coverageA;determine) outputT) + _ (case (monad;fold e;Monad<Error> coverageA;merge outputHC outputTC) (#e;Success coverage) - (if (&&coverage;exhaustive? coverage) + (if (coverageA;exhaustive? coverage) (wrap []) (&;fail "Pattern-matching is not exhaustive.")) diff --git a/new-luxc/source/luxc/analyser/case/coverage.lux b/new-luxc/source/luxc/lang/analysis/case/coverage.lux index 554aea1a8..554aea1a8 100644 --- a/new-luxc/source/luxc/analyser/case/coverage.lux +++ b/new-luxc/source/luxc/lang/analysis/case/coverage.lux diff --git a/new-luxc/source/luxc/analyser/common.lux b/new-luxc/source/luxc/lang/analysis/common.lux index 4cbf5aedf..4cbf5aedf 100644 --- a/new-luxc/source/luxc/analyser/common.lux +++ b/new-luxc/source/luxc/lang/analysis/common.lux diff --git a/new-luxc/source/luxc/analyser.lux b/new-luxc/source/luxc/lang/analysis/expression.lux index a7b872de5..e3a623089 100644 --- a/new-luxc/source/luxc/analyser.lux +++ b/new-luxc/source/luxc/lang/analysis/expression.lux @@ -14,12 +14,12 @@ (lang ["la" analysis]) ["&;" module] (generator [";G" common])) - (. ["&&;" common] - ["&&;" function] - ["&&;" primitive] - ["&&;" reference] - ["&&;" structure] - ["&&;" procedure])) + (.. [";A" common] + [";A" function] + [";A" primitive] + [";A" reference] + [";A" structure] + [";A" procedure])) (for {"JVM" (as-is (host;import java.lang.reflect.Method (invoke [Object (Array Object)] #try Object)) @@ -67,31 +67,31 @@ (^template [<tag> <analyser>] (<tag> value) (<analyser> value)) - ([#;Bool &&primitive;analyse-bool] - [#;Nat &&primitive;analyse-nat] - [#;Int &&primitive;analyse-int] - [#;Deg &&primitive;analyse-deg] - [#;Frac &&primitive;analyse-frac] - [#;Text &&primitive;analyse-text]) + ([#;Bool primitiveA;analyse-bool] + [#;Nat primitiveA;analyse-nat] + [#;Int primitiveA;analyse-int] + [#;Deg primitiveA;analyse-deg] + [#;Frac primitiveA;analyse-frac] + [#;Text primitiveA;analyse-text]) (^ (#;Tuple (list))) - &&primitive;analyse-unit + primitiveA;analyse-unit ## Singleton tuples are equivalent to the element they contain. (^ (#;Tuple (list singleton))) (analyse singleton) (^ (#;Tuple elems)) - (&&structure;analyse-product analyse elems) + (structureA;analyse-product analyse elems) (^ (#;Record pairs)) - (&&structure;analyse-record analyse pairs) + (structureA;analyse-record analyse pairs) (#;Symbol reference) - (&&reference;analyse-reference reference) + (referenceA;analyse-reference reference) (^ (#;Form (list& [_ (#;Text proc-name)] proc-args))) - (&&procedure;analyse-procedure analyse eval proc-name proc-args) + (procedureA;analyse-procedure analyse eval proc-name proc-args) (^template [<tag> <analyser>] (^ (#;Form (list& [_ (<tag> tag)] @@ -102,15 +102,15 @@ _ (<analyser> analyse tag (` [(~@ values)])))) - ([#;Nat &&structure;analyse-sum] - [#;Tag &&structure;analyse-tagged-sum]) + ([#;Nat structureA;analyse-sum] + [#;Tag structureA;analyse-tagged-sum]) (#;Tag tag) - (&&structure;analyse-tagged-sum analyse tag (' [])) + (structureA;analyse-tagged-sum analyse tag (' [])) (^ (#;Form (list& func args))) (do meta;Monad<Meta> - [[funcT =func] (&&common;with-unknown-type + [[funcT =func] (commonA;with-unknown-type (analyse func))] (case =func [_ (#;Symbol def-name)] @@ -131,10 +131,10 @@ _ (&;throw Macro-Expression-Must-Have-Single-Expansion (%code ast)))) - (&&function;analyse-apply analyse funcT =func args))) + (functionA;analyse-apply analyse funcT =func args))) _ - (&&function;analyse-apply analyse funcT =func args))) + (functionA;analyse-apply analyse funcT =func args))) _ (&;throw Unrecognized-Syntax (%code ast)) diff --git a/new-luxc/source/luxc/analyser/function.lux b/new-luxc/source/luxc/lang/analysis/function.lux index 3d2da6326..627fb7c0a 100644 --- a/new-luxc/source/luxc/analyser/function.lux +++ b/new-luxc/source/luxc/lang/analysis/function.lux @@ -12,10 +12,10 @@ (type ["tc" check]))) (luxc ["&" base] (lang ["la" analysis #+ Analysis] + (analysis ["&;" common] + ["&;" inference]) [";L" variable #+ Variable]) - ["&;" scope] - (analyser ["&;" common] - ["&;" inference]))) + ["&;" scope])) (exception: #export Invalid-Function-Type) (exception: #export Cannot-Apply-Function) diff --git a/new-luxc/source/luxc/analyser/inference.lux b/new-luxc/source/luxc/lang/analysis/inference.lux index 049abec28..cd484a623 100644 --- a/new-luxc/source/luxc/analyser/inference.lux +++ b/new-luxc/source/luxc/lang/analysis/inference.lux @@ -10,8 +10,8 @@ (meta [type] (type ["tc" check]))) (luxc ["&" base] - (lang ["la" analysis #+ Analysis]) - (analyser ["&;" common]))) + (lang ["la" analysis #+ Analysis] + (analysis ["&;" common])))) (exception: #export Cannot-Infer) (exception: #export Cannot-Infer-Argument) diff --git a/new-luxc/source/luxc/analyser/primitive.lux b/new-luxc/source/luxc/lang/analysis/primitive.lux index c7f7243fd..c7f7243fd 100644 --- a/new-luxc/source/luxc/analyser/primitive.lux +++ b/new-luxc/source/luxc/lang/analysis/primitive.lux diff --git a/new-luxc/source/luxc/analyser/procedure.lux b/new-luxc/source/luxc/lang/analysis/procedure.lux index 225fb7b23..225fb7b23 100644 --- a/new-luxc/source/luxc/analyser/procedure.lux +++ b/new-luxc/source/luxc/lang/analysis/procedure.lux diff --git a/new-luxc/source/luxc/analyser/procedure/common.lux b/new-luxc/source/luxc/lang/analysis/procedure/common.lux index 0fad41958..e06a3d2b4 100644 --- a/new-luxc/source/luxc/analyser/procedure/common.lux +++ b/new-luxc/source/luxc/lang/analysis/procedure/common.lux @@ -12,11 +12,11 @@ (type ["tc" check])) [io]) (luxc ["&" base] - (lang ["la" analysis]) - (analyser ["&;" common] - [";A" function] - [";A" case] - [";A" type]))) + (lang ["la" analysis] + (analysis ["&;" common] + [";A" function] + [";A" case] + [";A" type])))) ## [Utils] (type: #export Proc diff --git a/new-luxc/source/luxc/analyser/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux index 015379a1b..3ba7713ac 100644 --- a/new-luxc/source/luxc/analyser/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux @@ -22,9 +22,9 @@ [host]) (luxc ["&" base] ["&;" host] - (lang ["la" analysis]) - (analyser ["&;" common] - ["&;" inference])) + (lang ["la" analysis] + (analysis ["&;" common] + ["&;" inference]))) ["@" ../common] ) diff --git a/new-luxc/source/luxc/analyser/reference.lux b/new-luxc/source/luxc/lang/analysis/reference.lux index 5bc1f96c9..5bc1f96c9 100644 --- a/new-luxc/source/luxc/analyser/reference.lux +++ b/new-luxc/source/luxc/lang/analysis/reference.lux diff --git a/new-luxc/source/luxc/analyser/structure.lux b/new-luxc/source/luxc/lang/analysis/structure.lux index d523065ea..0284245e1 100644 --- a/new-luxc/source/luxc/analyser/structure.lux +++ b/new-luxc/source/luxc/lang/analysis/structure.lux @@ -18,11 +18,11 @@ [type] (type ["tc" check]))) (luxc ["&" base] - (lang ["la" analysis]) + (lang ["la" analysis] + (analysis ["&;" common] + ["&;" inference])) ["&;" module] - ["&;" scope] - (analyser ["&;" common] - ["&;" inference]))) + ["&;" scope])) (exception: #export Not-Variant-Type) (exception: #export Not-Tuple-Type) diff --git a/new-luxc/source/luxc/analyser/type.lux b/new-luxc/source/luxc/lang/analysis/type.lux index d0b038d93..d0b038d93 100644 --- a/new-luxc/source/luxc/analyser/type.lux +++ b/new-luxc/source/luxc/lang/analysis/type.lux diff --git a/new-luxc/source/luxc/parser.lux b/new-luxc/source/luxc/lang/parser.lux index 93800c1b7..93800c1b7 100644 --- a/new-luxc/source/luxc/parser.lux +++ b/new-luxc/source/luxc/lang/parser.lux |