diff options
author | Eduardo Julian | 2017-10-29 22:21:14 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-29 22:21:14 -0400 |
commit | 7b870a7bd124f35939d9089a2e21f0806a4c6e85 (patch) | |
tree | 076fb3544dbb1a811cfbb9dd54008b0753dead16 /new-luxc/source/luxc/generator/expr.jvm.lux | |
parent | 2dc99a7b62fc5fc19d9982ad4398606f3aebb7a5 (diff) |
- Fixed some bugs.
- Improved error reporting.
- Implemented macro-expansion (for JVM).
- Implemented "let" compilation.
Diffstat (limited to 'new-luxc/source/luxc/generator/expr.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/generator/expr.jvm.lux | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/new-luxc/source/luxc/generator/expr.jvm.lux b/new-luxc/source/luxc/generator/expr.jvm.lux index 116c29fb5..685bf2335 100644 --- a/new-luxc/source/luxc/generator/expr.jvm.lux +++ b/new-luxc/source/luxc/generator/expr.jvm.lux @@ -1,6 +1,7 @@ (;module: lux - (lux (control monad) + (lux (control monad + ["ex" exception #+ exception:]) (data text/format) [meta #+ Monad<Meta> "Meta/" Monad<Meta>]) (luxc ["&" base] @@ -15,8 +16,11 @@ ["&;" procedure] ["&;" function] ["&;" reference] + [";G" case] (host ["$" jvm])))) +(exception: #export Unrecognized-Synthesis) + (def: #export (generate synthesis) (-> ls;Synthesis (Meta $;Inst)) (case synthesis @@ -47,6 +51,12 @@ (#ls;Definition definition) (&reference;generate-definition definition) + (#ls;Let register inputS exprS) + (caseG;generate-let generate register inputS exprS) + + (#ls;Case inputS pathPS) + (caseG;generate-case generate inputS pathPS) + (#ls;Function arity env body) (&function;generate-function generate env arity body) @@ -57,25 +67,5 @@ (&procedure;generate-procedure generate name args) _ - (meta;fail "Unrecognized synthesis.") + (&;throw Unrecognized-Synthesis "") )) - -## (def: #export (eval type code) -## (-> Type Code (Meta Top)) -## (do Monad<Meta> -## [analysis (&;with-expected-type leftT -## (&analyser;analyser eval code)) -## #let [synthesis (&synthesizer;synthesize analysis)] -## inst (generate synthesis)] -## (&eval;eval inst))) - -## (def: analyse -## &;Analyser -## (&analyser;analyser eval)) - -## (def: #export (generate input) -## (-> Code (Meta Unit)) -## (do Monad<Meta> -## [analysis (analyse input) -## #let [synthesis (&synthesizer;synthesize analysis)]] -## (generate-synthesis synthesis))) |