diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux new file mode 100644 index 000000000..9612cdb7a --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux @@ -0,0 +1,36 @@ +(.module: + lux + (lux [macro] + (data [text] + text/format)) + (luxc ["&" lang] + (lang [".L" variable #+ Variable Register] + (host [ruby #+ Ruby Expression Statement]))) + [//] + (// [".T" runtime])) + +(do-template [<register> <translation> <prefix>] + [(def: #export (<register> register) + (-> Register Expression) + (format <prefix> (%i (nat-to-int register)))) + + (def: #export (<translation> register) + (-> Register (Meta Expression)) + (:: macro.Monad<Meta> wrap (<register> register)))] + + [closure translate-captured "c"] + [variable translate-local "v"]) + +(def: #export (translate-variable var) + (-> Variable (Meta Expression)) + (if (variableL.captured? var) + (translate-captured (variableL.captured-register var)) + (translate-local (int-to-nat var)))) + +(def: #export global + (-> Ident Expression) + //.definition-name) + +(def: #export (translate-definition name) + (-> Ident (Meta Expression)) + (:: macro.Monad<Meta> wrap (ruby.global (global name)))) |