diff options
author | Eduardo Julian | 2019-02-12 18:56:18 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-02-12 18:56:18 -0400 |
commit | 845ccb5460583df6cbf37824c2eed82729a24804 (patch) | |
tree | 52dc2b64b8d6f08fd3e4717e9fb3c31aa2704833 /stdlib/source/lux/tool/compiler/default/evaluation.lux | |
parent | 733e35d9e17d1fc0bdb642e7b56ebd7ac34d4b67 (diff) |
Re-named "lux/platform" to "lux/tool".
Diffstat (limited to 'stdlib/source/lux/tool/compiler/default/evaluation.lux')
-rw-r--r-- | stdlib/source/lux/tool/compiler/default/evaluation.lux | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/stdlib/source/lux/tool/compiler/default/evaluation.lux b/stdlib/source/lux/tool/compiler/default/evaluation.lux new file mode 100644 index 000000000..1f21304ca --- /dev/null +++ b/stdlib/source/lux/tool/compiler/default/evaluation.lux @@ -0,0 +1,36 @@ +(.module: + [lux #* + [control + [monad (#+ do)]] + [data + ["." error] + [text + format]]] + [/// + ["." phase + [analysis (#+ Operation) + [".A" expression] + ["." type]] + ["." synthesis + [".S" expression]] + ["." translation]]]) + +(type: #export Eval + (-> Nat Type Code (Operation Any))) + +(def: #export (evaluator synthesis-state translation-state translate) + (All [anchor expression statement] + (-> 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)))))))) |