aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/generator
diff options
context:
space:
mode:
authorEduardo Julian2017-10-31 22:26:13 -0400
committerEduardo Julian2017-10-31 22:26:13 -0400
commit19c589edc2c1dd77550e26d4f5cf78ec772da337 (patch)
treed070c773c7bd5cec8d33caa1841fbe0e342ec563 /new-luxc/source/luxc/generator
parent6c753288a89eadb3f7d70a8844e466c48c809051 (diff)
- Migrated the format of analysis nodes from a custom data-type, to just Code nodes.
Diffstat (limited to 'new-luxc/source/luxc/generator')
-rw-r--r--new-luxc/source/luxc/generator/expression.jvm.lux6
-rw-r--r--new-luxc/source/luxc/generator/function.jvm.lux26
-rw-r--r--new-luxc/source/luxc/generator/procedure/common.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/procedure/host.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/reference.jvm.lux7
5 files changed, 20 insertions, 21 deletions
diff --git a/new-luxc/source/luxc/generator/expression.jvm.lux b/new-luxc/source/luxc/generator/expression.jvm.lux
index 624070145..5eb8d7c47 100644
--- a/new-luxc/source/luxc/generator/expression.jvm.lux
+++ b/new-luxc/source/luxc/generator/expression.jvm.lux
@@ -9,10 +9,10 @@
(meta ["s" syntax]))
(luxc ["&" base]
(host ["$" jvm])
- (lang ["ls" synthesis])
+ (lang ["ls" synthesis]
+ [";L" variable #+ Variable Register])
["&;" analyser]
["&;" synthesizer]
- (synthesizer [";S" function])
(generator ["&;" common]
["&;" primitive]
["&;" structure]
@@ -50,7 +50,7 @@
(&structure;generate-tuple generate members)
(^ [_ (#;Form (list [_ (#;Int var)]))])
- (if (functionS;captured? var)
+ (if (variableL;captured? var)
(&reference;generate-captured var)
(&reference;generate-variable var))
diff --git a/new-luxc/source/luxc/generator/function.jvm.lux b/new-luxc/source/luxc/generator/function.jvm.lux
index 1b0939856..ed90d3aa2 100644
--- a/new-luxc/source/luxc/generator/function.jvm.lux
+++ b/new-luxc/source/luxc/generator/function.jvm.lux
@@ -11,10 +11,10 @@
["$d" def]
["$i" inst]))
(lang ["la" analysis]
- ["ls" synthesis])
+ ["ls" synthesis]
+ [";L" variable #+ Variable])
["&;" analyser]
["&;" synthesizer]
- (synthesizer [function])
(generator ["&;" common]
["&;" runtime])))
@@ -40,11 +40,11 @@
($t;method (list) (#;Some ($t;class class (list))) (list)))
(def: (captured-args env)
- (-> (List ls;Variable) (List $;Type))
+ (-> (List Variable) (List $;Type))
(list;repeat (list;size env) $Object))
(def: (init-method env arity)
- (-> (List ls;Variable) ls;Arity $;Method)
+ (-> (List Variable) ls;Arity $;Method)
(if (poly-arg? arity)
($t;method (list;concat (list (captured-args env)
(list $t;int)
@@ -95,7 +95,7 @@
$i;fuse))
(def: (with-captured env)
- (-> (List ls;Variable) $;Def)
+ (-> (List Variable) $;Def)
(|> (list;enumerate env)
(list/map (function [[env-idx env-source]]
($d;field #$;Private $;finalF (captured env-idx) $Object)))
@@ -111,11 +111,11 @@
id))
(def: (instance class arity env)
- (-> Text ls;Arity (List ls;Variable) $;Inst)
+ (-> Text ls;Arity (List Variable) $;Inst)
(let [captureI (|> env
(list/map (function [source]
- (if (function;captured? source)
- ($i;GETFIELD class (captured (function;captured-idx source)) $Object)
+ (if (variableL;captured? source)
+ ($i;GETFIELD class (captured (variableL;captured-register source)) $Object)
($i;ALOAD (int-to-nat source)))))
$i;fuse)
argsI (if (poly-arg? arity)
@@ -130,7 +130,7 @@
($i;INVOKESPECIAL class "<init>" (init-method env arity) false))))
(def: (with-reset class arity env)
- (-> Text ls;Arity (List ls;Variable) $;Def)
+ (-> Text ls;Arity (List Variable) $;Def)
($d;method #$;Public $;noneM "reset" (reset-method class)
(if (poly-arg? arity)
(let [env-size (list;size env)
@@ -173,7 +173,7 @@
($i;INVOKESPECIAL hostL;function-class "<init>" function-init-method false))))
(def: (with-init class env arity)
- (-> Text (List ls;Variable) ls;Arity $;Def)
+ (-> Text (List Variable) ls;Arity $;Def)
(let [env-size (list;size env)
offset-partial (: (-> Nat Nat)
(|>. n.inc (n.+ env-size)))
@@ -202,7 +202,7 @@
$i;RETURN))))
(def: (with-apply class env function-arity @begin bodyI apply-arity)
- (-> Text (List ls;Variable) ls;Arity $;Label $;Inst ls;Arity
+ (-> Text (List Variable) ls;Arity $;Label $;Inst ls;Arity
$;Def)
(let [num-partials (n.dec function-arity)
@default ($;new-label [])
@@ -270,7 +270,7 @@
(def: #export (with-function generate class env arity body)
(-> (-> ls;Synthesis (Meta $;Inst))
- Text (List ls;Variable) ls;Arity ls;Synthesis
+ Text (List Variable) ls;Arity ls;Synthesis
(Meta [$;Def $;Inst]))
(do meta;Monad<Meta>
[@begin $i;make-label
@@ -299,7 +299,7 @@
(def: #export (generate-function generate env arity body)
(-> (-> ls;Synthesis (Meta $;Inst))
- (List ls;Variable) ls;Arity ls;Synthesis
+ (List Variable) ls;Arity ls;Synthesis
(Meta $;Inst))
(do meta;Monad<Meta>
[function-class (:: @ map %code (meta;gensym "function"))
diff --git a/new-luxc/source/luxc/generator/procedure/common.jvm.lux b/new-luxc/source/luxc/generator/procedure/common.jvm.lux
index d94ded890..a61b7f0fe 100644
--- a/new-luxc/source/luxc/generator/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/generator/procedure/common.jvm.lux
@@ -19,7 +19,6 @@
["ls" synthesis])
["&;" analyser]
["&;" synthesizer]
- (synthesizer [function])
(generator ["&;" common]
["&;" runtime])))
diff --git a/new-luxc/source/luxc/generator/procedure/host.jvm.lux b/new-luxc/source/luxc/generator/procedure/host.jvm.lux
index 5fb779d41..bc57d6a2b 100644
--- a/new-luxc/source/luxc/generator/procedure/host.jvm.lux
+++ b/new-luxc/source/luxc/generator/procedure/host.jvm.lux
@@ -25,7 +25,6 @@
["&;" analyser]
(analyser (procedure ["&;" host]))
["&;" synthesizer]
- (synthesizer [function])
(generator ["&;" common]
["&;" runtime]))
["@" ../common])
diff --git a/new-luxc/source/luxc/generator/reference.jvm.lux b/new-luxc/source/luxc/generator/reference.jvm.lux
index 3c8cbc552..9af511167 100644
--- a/new-luxc/source/luxc/generator/reference.jvm.lux
+++ b/new-luxc/source/luxc/generator/reference.jvm.lux
@@ -7,12 +7,13 @@
(host ["$" jvm]
(jvm ["$t" type]
["$i" inst]))
- (lang ["ls" synthesis])
+ (lang ["ls" synthesis]
+ [";L" variable #+ Variable])
(generator [";G" common]
[";G" function])))
(def: #export (generate-captured variable)
- (-> ls;Variable (Meta $;Inst))
+ (-> Variable (Meta $;Inst))
(do meta;Monad<Meta>
[function-class commonG;function]
(wrap (|>. ($i;ALOAD +0)
@@ -21,7 +22,7 @@
commonG;$Object)))))
(def: #export (generate-variable variable)
- (-> ls;Variable (Meta $;Inst))
+ (-> Variable (Meta $;Inst))
(meta/wrap ($i;ALOAD (int-to-nat variable))))
(def: #export (generate-definition [def-module def-name])