From 7b870a7bd124f35939d9089a2e21f0806a4c6e85 Mon Sep 17 00:00:00 2001
From: Eduardo Julian
Date: Sun, 29 Oct 2017 22:21:14 -0400
Subject: - Fixed some bugs. - Improved error reporting. - Implemented
macro-expansion (for JVM). - Implemented "let" compilation.
---
new-luxc/source/luxc/generator/expr.jvm.lux | 34 ++++++++++-------------------
1 file changed, 12 insertions(+), 22 deletions(-)
(limited to 'new-luxc/source/luxc/generator/expr.jvm.lux')
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/" Monad])
(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
-## [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
-## [analysis (analyse input)
-## #let [synthesis (&synthesizer;synthesize analysis)]]
-## (generate-synthesis synthesis)))
--
cgit v1.2.3