diff options
author | Eduardo Julian | 2018-03-13 23:28:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-03-13 23:28:19 -0400 |
commit | b14f95ca68887d9e6cea211b47e04e5ec00c05fa (patch) | |
tree | 4fad118bec9800bfae885dcb6311e8755b98918a /new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux | |
parent | 38bd6f35d81705ab0c04c85601ac5b236b62605a (diff) |
- Initial Ruby back-end implementation.
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)))) |