aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification/compositor.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-07-15 00:45:15 -0400
committerEduardo Julian2021-07-15 00:45:15 -0400
commit0abd5bd3c0e38e352e9ba38268e04e1c858ab01e (patch)
treefe0af9e70413e9fc4f3848e0642920fca501c626 /stdlib/source/specification/compositor.lux
parent89ca40f2f101b2b38187eab5cf905371cd47eb57 (diff)
Re-named "spec" hierarchy to "specification".
Diffstat (limited to 'stdlib/source/specification/compositor.lux')
-rw-r--r--stdlib/source/specification/compositor.lux67
1 files changed, 67 insertions, 0 deletions
diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux
new file mode 100644
index 000000000..08a294282
--- /dev/null
+++ b/stdlib/source/specification/compositor.lux
@@ -0,0 +1,67 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." io (#+ IO)]
+ ["." try]]
+ [math
+ ["r" random]]
+ [tool
+ [compiler
+ ["." analysis]
+ ["." directive]
+ [phase
+ [macro (#+ Expander)]
+ [generation (#+ Bundle)]]
+ [default
+ [platform (#+ Platform)]]]]]
+ ["." / #_
+ ["#." common (#+ Runner Definer)]
+ ["#./" analysis #_
+ ["#." type]]
+ ["#./" generation #_
+ ["#." primitive]
+ ["#." structure]
+ ["#." reference]
+ ["#." case]
+ ["#." function]
+ ["#." common]]])
+
+(def: (test runner definer state expander)
+ (-> Runner Definer analysis.State+ Expander Test)
+ ($_ _.and
+ (/analysis/type.spec expander state)
+ (/generation/primitive.spec runner)
+ (/generation/structure.spec runner)
+ (/generation/reference.spec runner definer)
+ (/generation/case.spec runner)
+ (/generation/function.spec runner)
+ (/generation/common.spec runner)
+ ))
+
+(def: #export (spec platform bundle expander program)
+ (All [anchor expression directive]
+ (-> (IO (Platform IO anchor expression directive))
+ (Bundle anchor expression directive)
+ Expander
+ (-> expression directive)
+ Test))
+ (do r.monad
+ [_ (wrap [])
+ #let [?state,runner,definer (<| io.run
+ (do io.monad
+ [platform platform])
+ (/common.executors platform
+ bundle
+ expander
+ program))]]
+ (case ?state,runner,definer
+ (#try.Success [[directive-bundle directive-state] runner definer])
+ (..test runner definer
+ (get@ [#directive.analysis #directive.state] directive-state)
+ expander)
+
+ (#try.Failure error)
+ (_.fail error))))