diff options
Diffstat (limited to 'stdlib/source/lux/compiler/default/evaluation.lux')
-rw-r--r-- | stdlib/source/lux/compiler/default/evaluation.lux | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/stdlib/source/lux/compiler/default/evaluation.lux b/stdlib/source/lux/compiler/default/evaluation.lux index 3e00d79c5..d93feca93 100644 --- a/stdlib/source/lux/compiler/default/evaluation.lux +++ b/stdlib/source/lux/compiler/default/evaluation.lux @@ -1,30 +1,34 @@ (.module: [lux #* [control - [monad (#+ do)] - pipe] + [monad (#+ do)]] [data ["." error]]] [// - ["." phase (#+ Eval) - ["." analysis - [".A" expression]] + ["." phase + [analysis (#+ Operation) + [".A" expression] + ["." type]] ["." synthesis [".S" expression]] ["." translation]]]) -(def: #export (evaluator analysis-state synthesis-state translation-state translate) +(type: #export Eval + (-> Type Code (Operation Any))) + +(def: #export (evaluator synthesis-state translation-state translate) (All [anchor expression statement] - (-> analysis.State+ - synthesis.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)))))) + (do phase.Monad<Operation> + [exprA (type.with-type type + (expressionA.compile exprC))] + (phase.lift (do error.Monad<Error> + [exprS (|> exprA expressionS.synthesize (phase.run synthesis-state))] + (phase.run translation-state + (do phase.Monad<Operation> + [exprO (translate exprS)] + (translation.evaluate! exprO)))))))) |