diff options
author | Eduardo Julian | 2017-09-19 19:24:09 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-09-19 19:24:09 -0400 |
commit | 3744a2212a89d4ab0f176350d2d2f90696235a40 (patch) | |
tree | 28e9da49deddcb8253fca2ae94f479ba64cb5536 /new-luxc/source/luxc/generator/reference.jvm.lux | |
parent | e6afba3e17f03ed0652d18a26d0f3c053a49e7a5 (diff) |
- Function generation.
Diffstat (limited to 'new-luxc/source/luxc/generator/reference.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/generator/reference.jvm.lux | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/generator/reference.jvm.lux b/new-luxc/source/luxc/generator/reference.jvm.lux new file mode 100644 index 000000000..28c936036 --- /dev/null +++ b/new-luxc/source/luxc/generator/reference.jvm.lux @@ -0,0 +1,26 @@ +(;module: + lux + (lux (control [monad #+ do]) + (data text/format) + [macro "lux/" Monad<Lux>]) + (luxc (lang ["ls" synthesis]) + (generator [";G" common] + [";G" function] + (host ["$" jvm] + (jvm ["$t" type] + ["$i" inst]))))) + +(def: $Object $;Type ($t;class "java.lang.Object" (list))) + +(def: #export (generate-captured variable) + (-> ls;Variable (Lux $;Inst)) + (do macro;Monad<Lux> + [function-class commonG;function] + (wrap (|>. ($i;ALOAD +0) + ($i;GETFIELD function-class + (|> variable i.inc (i.* -1) int-to-nat functionG;captured) + $Object))))) + +(def: #export (generate-variable variable) + (-> ls;Variable (Lux $;Inst)) + (lux/wrap ($i;ALOAD (int-to-nat variable)))) |