diff options
author | Eduardo Julian | 2017-11-01 00:51:45 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-01 00:51:45 -0400 |
commit | 012f6bd41e527479dddbccbdab10daa78fd9a0fd (patch) | |
tree | 621f344a09acd52736f343d94582b3f1a2f0c5f9 /new-luxc/source/luxc/lang/translation/reference.jvm.lux | |
parent | 71d7a4c7206155e09f3e1e1d8699561ea6967382 (diff) |
- Re-organized code-generation, and re-named it "translation".
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/reference.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/reference.jvm.lux | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/reference.jvm.lux new file mode 100644 index 000000000..7c42f9f08 --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/reference.jvm.lux @@ -0,0 +1,31 @@ +(;module: + lux + (lux (control [monad #+ do]) + (data text/format) + [meta "meta/" Monad<Meta>]) + (luxc ["&" base] + (host ["$" jvm] + (jvm ["$t" type] + ["$i" inst])) + (lang ["ls" synthesis] + [";L" variable #+ Variable] + (translation [";T" common] + [";T" function])))) + +(def: #export (generate-captured variable) + (-> Variable (Meta $;Inst)) + (do meta;Monad<Meta> + [function-class commonT;function] + (wrap (|>. ($i;ALOAD +0) + ($i;GETFIELD function-class + (|> variable i.inc (i.* -1) int-to-nat functionT;captured) + commonT;$Object))))) + +(def: #export (generate-variable variable) + (-> Variable (Meta $;Inst)) + (meta/wrap ($i;ALOAD (int-to-nat variable)))) + +(def: #export (generate-definition [def-module def-name]) + (-> Ident (Meta $;Inst)) + (let [bytecode-name (format def-module "/" (&;normalize-name def-name))] + (meta/wrap ($i;GETSTATIC bytecode-name commonT;value-field commonT;$Object)))) |