diff options
author | Eduardo Julian | 2019-05-28 18:48:01 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-05-28 18:48:01 -0400 |
commit | 926c3e1dcc392dc21b77a93200fa3e01eb113cf2 (patch) | |
tree | 72a57dde416f7d263514190950a6686714008dee /stdlib/source/lux/tool | |
parent | a420abd8ef1d5a008a5a0b6f75590cab2a9baac5 (diff) |
Applied several tweaks to make the code easier to process by the new compiler.
Diffstat (limited to 'stdlib/source/lux/tool')
26 files changed, 38 insertions, 65 deletions
diff --git a/stdlib/source/lux/tool/compiler/analysis.lux b/stdlib/source/lux/tool/compiler/analysis.lux index 2c4cdbc53..998306d4a 100644 --- a/stdlib/source/lux/tool/compiler/analysis.lux +++ b/stdlib/source/lux/tool/compiler/analysis.lux @@ -78,9 +78,8 @@ ) (template [<name> <type> <tag>] - [(def: #export <name> - (-> <type> Analysis) - (|>> <tag> #..Primitive))] + [(template: #export (<name> value) + (#..Primitive (<tag> value)))] [bit Bit #..Bit] [nat Nat #..Nat] diff --git a/stdlib/source/lux/tool/compiler/default/init.lux b/stdlib/source/lux/tool/compiler/default/init.lux index 5cb857d65..a7a861289 100644 --- a/stdlib/source/lux/tool/compiler/default/init.lux +++ b/stdlib/source/lux/tool/compiler/default/init.lux @@ -91,10 +91,10 @@ (-> Source Reader (///analysis.Operation [Source Code])) (function (_ [bundle compiler]) (case (reader source) - (#error.Failure [source' error]) + (#.Left [source' error]) (#error.Failure error) - (#error.Success [source' output]) + (#.Right [source' output]) (let [[cursor _] output] (#error.Success [[bundle (|> compiler (set@ #.source source') diff --git a/stdlib/source/lux/tool/compiler/name.lux b/stdlib/source/lux/tool/compiler/name.lux index d2841d849..252d57051 100644 --- a/stdlib/source/lux/tool/compiler/name.lux +++ b/stdlib/source/lux/tool/compiler/name.lux @@ -40,7 +40,10 @@ output ""] (if (n/< name/size idx) (recur (inc idx) - (|> name ("lux text char" idx) !sanitize (format output))) + (|> name + ("lux text char" idx) + !sanitize + (format output))) output)))) (def: #export (definition [module short]) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/common-lisp.lux b/stdlib/source/lux/tool/compiler/phase/generation/common-lisp.lux index 480c473bf..6d3500416 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/common-lisp.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/common-lisp.lux @@ -13,6 +13,7 @@ ["." /// ["." extension] [// + [analysis (#+)] ["." synthesis]]]]) (def: #export (generate synthesis) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/common-lisp/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/common-lisp/case.lux index dd5b89e38..6f24f6c23 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/common-lisp/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/common-lisp/case.lux @@ -97,8 +97,6 @@ (def: fail! (_.return-from ..@fail _.nil)) -(exception: #export unrecognized-path) - (def: (multi-pop! pops) (-> Nat (Expression Any)) (_.setq @cursor (_.nthcdr/2 [(_.int (.int pops)) @cursor]))) @@ -188,10 +186,7 @@ post! (pattern-matching' generate postP)] (wrap (<combinator> pre! post!)))) ([/////synthesis.path/alt ..alternation] - [/////synthesis.path/seq _.progn]) - - _ - (////.throw unrecognized-path []))) + [/////synthesis.path/seq _.progn]))) (def: (pattern-matching generate pathP) (-> Phase Path (Operation (Expression Any))) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/common-lisp/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/common-lisp/extension/common.lux index a72239982..8f323544e 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/common-lisp/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/common-lisp/extension/common.lux @@ -63,8 +63,8 @@ ))) (import: #long java/lang/Double - (#static MIN_VALUE Double) - (#static MAX_VALUE Double)) + (#static MIN_VALUE double) + (#static MAX_VALUE double)) (template [<name> <const>] [(def: (<name> _) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js.lux b/stdlib/source/lux/tool/compiler/phase/generation/js.lux index 37a8d1bc6..c0cd734b3 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/js.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/js.lux @@ -13,6 +13,7 @@ ["." /// ["." extension] [// + [analysis (#+)] ["." synthesis]]]]) (def: #export (generate synthesis) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux index edfa2d038..e1182c4b5 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux @@ -100,8 +100,6 @@ (def: fail-pm! _.break) -(exception: #export unrecognized-path) - (def: (multi-pop-cursor! pops) (-> Nat Statement) (.let [popsJS (_.i32 (.int pops))] @@ -200,10 +198,7 @@ right! (pattern-matching' generate rightP)] (wrap (<combinator> left! right!)))) ([/////synthesis.path/seq _.then] - [/////synthesis.path/alt alternation]) - - _ - (////.throw unrecognized-path []))) + [/////synthesis.path/alt alternation]))) (def: (pattern-matching generate pathP) (-> Phase Path (Operation Statement)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux index 7a38dc5cd..5253ffe19 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux @@ -33,8 +33,8 @@ ## [[Numbers]] (import: #long java/lang/Double - (#static MIN_VALUE Double) - (#static MAX_VALUE Double)) + (#static MIN_VALUE double) + (#static MAX_VALUE double)) (template [<name> <const>] [(def: (<name> _) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/lua.lux b/stdlib/source/lux/tool/compiler/phase/generation/lua.lux index 480c473bf..6d3500416 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/lua.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/lua.lux @@ -13,6 +13,7 @@ ["." /// ["." extension] [// + [analysis (#+)] ["." synthesis]]]]) (def: #export (generate synthesis) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/lua/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/lua/case.lux index 1e2e7d254..d69668611 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/lua/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/lua/case.lux @@ -104,8 +104,6 @@ (def: fail! _.break) -(exception: #export unrecognized-path) - (template [<name> <flag> <prep>] [(def: (<name> simple? idx) (-> Bit Nat Statement) @@ -188,10 +186,7 @@ post! (pattern-matching' generate postP)] (wrap (<combinator> pre! post!)))) ([/////synthesis.path/seq _.then] - [/////synthesis.path/alt ..alternation]) - - _ - (////.throw unrecognized-path []))) + [/////synthesis.path/alt ..alternation]))) (def: (pattern-matching generate pathP) (-> Phase Path (Operation Statement)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/lua/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/lua/extension/common.lux index e9aafeef6..25159b2a7 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/lua/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/lua/extension/common.lux @@ -57,8 +57,8 @@ (bundle.install "char" (unary (!unary "string.char")))))) (import: #long java/lang/Double - (#static MIN_VALUE Double) - (#static MAX_VALUE Double)) + (#static MIN_VALUE double) + (#static MAX_VALUE double)) (template [<name> <const>] [(def: (<name> _) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/php.lux b/stdlib/source/lux/tool/compiler/phase/generation/php.lux index 480c473bf..6d3500416 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/php.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/php.lux @@ -13,6 +13,7 @@ ["." /// ["." extension] [// + [analysis (#+)] ["." synthesis]]]]) (def: #export (generate synthesis) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/php/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/php/case.lux index 4e672e600..4bd86c94e 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/php/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/php/case.lux @@ -100,8 +100,6 @@ (def: fail! _.break) -(exception: #export unrecognized-path) - (def: (multi-pop! pops) (-> Nat Statement) (_.; (_.array-splice/3 [@cursor @@ -198,10 +196,7 @@ post! (pattern-matching' generate postP)] (wrap (<combinator> pre! post!)))) ([/////synthesis.path/seq _.then] - [/////synthesis.path/alt ..alternation]) - - _ - (////.throw unrecognized-path []))) + [/////synthesis.path/alt ..alternation]))) (def: (pattern-matching generate pathP) (-> Phase Path (Operation Statement)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/php/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/php/extension/common.lux index bdda1861b..74f61fd22 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/php/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/php/extension/common.lux @@ -55,8 +55,8 @@ (bundle.install "char" (unary _.chr/1))))) (import: #long java/lang/Double - (#static MIN_VALUE Double) - (#static MAX_VALUE Double)) + (#static MIN_VALUE double) + (#static MAX_VALUE double)) (template [<name> <const>] [(def: (<name> _) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/python.lux b/stdlib/source/lux/tool/compiler/phase/generation/python.lux index 37a8d1bc6..c0cd734b3 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/python.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/python.lux @@ -13,6 +13,7 @@ ["." /// ["." extension] [// + [analysis (#+)] ["." synthesis]]]]) (def: #export (generate synthesis) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/python/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/python/case.lux index 3e07a6730..d0f887385 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/python/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/python/case.lux @@ -98,8 +98,6 @@ (def: fail-pm! _.break) -(exception: #export unrecognized-path) - (def: (multi-pop! pops) (-> Nat (Statement Any)) (_.delete (_.slice-from (_.int (i/* -1 (.int pops))) @cursor))) @@ -195,10 +193,7 @@ post! (pattern-matching' generate postP)] (wrap (<combinator> pre! post!)))) ([/////synthesis.path/seq _.then] - [/////synthesis.path/alt ..alternation]) - - _ - (////.throw unrecognized-path []))) + [/////synthesis.path/alt ..alternation]))) (def: (pattern-matching generate pathP) (-> Phase Path (Operation (Statement Any))) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/python/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/python/extension/common.lux index 7e1b4d2c1..0714fd26c 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/python/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/python/extension/common.lux @@ -54,8 +54,8 @@ (bundle.install "char" (unary _.chr/1))))) (import: #long java/lang/Double - (#static MIN_VALUE Double) - (#static MAX_VALUE Double)) + (#static MIN_VALUE double) + (#static MAX_VALUE double)) (template [<name> <const>] [(def: (<name> _) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/ruby.lux b/stdlib/source/lux/tool/compiler/phase/generation/ruby.lux index 155d3e13c..a83ac89e1 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/ruby.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/ruby.lux @@ -13,6 +13,7 @@ ["." /// ["." extension] [// + [analysis (#+)] ["." synthesis]]]]) (def: #export (generate synthesis) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/ruby/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/ruby/case.lux index 614925cd6..25d6ff91a 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/ruby/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/ruby/case.lux @@ -99,8 +99,6 @@ (def: fail! _.break) -(exception: #export unrecognized-path) - (def: (multi-pop! pops) (-> Nat (Statement Any)) (_.statement (_.do "slice!" (list (_.int (i/* -1 (.int pops))) @@ -197,10 +195,7 @@ post! (pattern-matching' generate postP)] (wrap (<combinator> pre! post!)))) ([/////synthesis.path/seq _.then] - [/////synthesis.path/alt ..alternation]) - - _ - (////.throw unrecognized-path []))) + [/////synthesis.path/alt ..alternation]))) (def: (pattern-matching generate pathP) (-> Phase Path (Operation (Statement Any))) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/ruby/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/ruby/extension/common.lux index cb72ecca0..80dbb312c 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/ruby/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/ruby/extension/common.lux @@ -50,8 +50,8 @@ ))) (import: #long java/lang/Double - (#static MIN_VALUE Double) - (#static MAX_VALUE Double)) + (#static MIN_VALUE double) + (#static MAX_VALUE double)) (template [<name> <const>] [(def: (<name> _) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme.lux index 2ccf4f45a..0152ffbcd 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme.lux @@ -13,6 +13,7 @@ ["." /// ["." extension] [// + [analysis (#+)] ["." synthesis]]]]) (def: #export (generate synthesis) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/case.lux index 04d3bae1d..bd478f921 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/case.lux @@ -96,8 +96,6 @@ (def: fail-pm! (_.raise/1 pm-error)) -(exception: #export unrecognized-path) - (def: (pm-catch handler) (-> Expression Computation) (_.lambda [(list @alt-error) #.None] @@ -154,10 +152,7 @@ rightO))) (_.lambda [(list) #.None] (_.begin (list save-cursor! - leftO))))]) - - _ - (////.throw unrecognized-path []))) + leftO))))]))) (def: (pattern-matching generate pathP) (-> Phase Path (Operation Computation)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux index 6701bc078..8140c769f 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux @@ -102,8 +102,8 @@ (///runtime.i64//logical-right-shift (_.remainder/2 (_.int +64) paramO) subjectO)) (import: java/lang/Double - (#static MIN_VALUE Double) - (#static MAX_VALUE Double)) + (#static MIN_VALUE double) + (#static MAX_VALUE double)) (template [<name> <const> <encode>] [(def: (<name> _) diff --git a/stdlib/source/lux/tool/compiler/phase/statement.lux b/stdlib/source/lux/tool/compiler/phase/statement.lux index 1660fdf01..2f3c68f7b 100644 --- a/stdlib/source/lux/tool/compiler/phase/statement.lux +++ b/stdlib/source/lux/tool/compiler/phase/statement.lux @@ -16,6 +16,7 @@ [".P" analysis ["." type]] ["#/" // #_ + [reference (#+)] ["#." analysis] ["/" statement (#+ Phase)]]]) diff --git a/stdlib/source/lux/tool/compiler/phase/synthesis.lux b/stdlib/source/lux/tool/compiler/phase/synthesis.lux index 0e01c0f68..1b92abf97 100644 --- a/stdlib/source/lux/tool/compiler/phase/synthesis.lux +++ b/stdlib/source/lux/tool/compiler/phase/synthesis.lux @@ -16,6 +16,7 @@ ["#/" // ("#;." monad) ["#." extension] ["#/" // #_ + [reference (#+)] ["#." analysis (#+ Analysis)] ["/" synthesis (#+ Synthesis Phase)]]]]) @@ -84,7 +85,4 @@ (do //.monad [argsS+ (monad.map @ phase args)] (wrap (#/.Extension [name argsS+]))))))) - - _ - (//;wrap (undefined)) )) |