diff options
Diffstat (limited to 'stdlib/source/lux/tool/compiler/default/evaluation.lux')
-rw-r--r-- | stdlib/source/lux/tool/compiler/default/evaluation.lux | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/stdlib/source/lux/tool/compiler/default/evaluation.lux b/stdlib/source/lux/tool/compiler/default/evaluation.lux index 1f21304ca..68fda1e7d 100644 --- a/stdlib/source/lux/tool/compiler/default/evaluation.lux +++ b/stdlib/source/lux/tool/compiler/default/evaluation.lux @@ -10,7 +10,8 @@ ["." phase [analysis (#+ Operation) [".A" expression] - ["." type]] + ["." type] + [macro (#+ Expander)]] ["." synthesis [".S" expression]] ["." translation]]]) @@ -18,19 +19,21 @@ (type: #export Eval (-> Nat Type Code (Operation Any))) -(def: #export (evaluator synthesis-state translation-state translate) +(def: #export (evaluator expander synthesis-state translation-state translate) (All [anchor expression statement] - (-> synthesis.State+ + (-> Expander + synthesis.State+ (translation.State+ anchor expression statement) (translation.Phase anchor expression statement) Eval)) - (function (eval count type exprC) - (do phase.monad - [exprA (type.with-type type - (expressionA.compile exprC))] - (phase.lift (do error.monad - [exprS (|> exprA expressionS.phase (phase.run synthesis-state))] - (phase.run translation-state - (do phase.monad - [exprO (translate exprS)] - (translation.evaluate! (format "eval" (%n count)) exprO)))))))) + (let [analyze (expressionA.phase expander)] + (function (eval count type exprC) + (do phase.monad + [exprA (type.with-type type + (analyze exprC))] + (phase.lift (do error.monad + [exprS (|> exprA expressionS.phase (phase.run synthesis-state))] + (phase.run translation-state + (do phase.monad + [exprO (translate exprS)] + (translation.evaluate! (format "eval" (%n count)) exprO))))))))) |