aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/compiler/default/evaluation.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/compiler/default/evaluation.lux')
-rw-r--r--stdlib/source/lux/compiler/default/evaluation.lux30
1 files changed, 30 insertions, 0 deletions
diff --git a/stdlib/source/lux/compiler/default/evaluation.lux b/stdlib/source/lux/compiler/default/evaluation.lux
new file mode 100644
index 000000000..26c4b0355
--- /dev/null
+++ b/stdlib/source/lux/compiler/default/evaluation.lux
@@ -0,0 +1,30 @@
+(.module:
+ [lux #*
+ [control
+ [monad (#+ do)]
+ pipe]
+ [data
+ ["." error]]]
+ ["." // (#+ Eval)
+ ["." phase
+ ["." analysis
+ [".A" expression]]
+ ["." synthesis
+ [".S" expression]]
+ ["." translation]]])
+
+(def: #export (evaluator analysis-state synthesis-state translation-state translate)
+ (All [anchor expression statement]
+ (-> analysis.State+
+ synthesis.State+
+ (translation.State+ anchor expression statement)
+ (translation.Phase anchor expression statement)
+ Eval))
+ (function (eval type exprC)
+ (do error.Monad<Error>
+ [exprA (|> exprC (expressionA.analyser eval)(phase.run analysis-state))
+ exprS (|> exprA expressionS.synthesize (phase.run synthesis-state))]
+ (phase.run translation-state
+ (do phase.Monad<Operation>
+ [exprO (translate exprS)]
+ (translation.evaluate! exprO))))))