diff options
author | Eduardo Julian | 2018-03-06 01:07:43 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-03-06 01:07:43 -0400 |
commit | 38bd6f35d81705ab0c04c85601ac5b236b62605a (patch) | |
tree | 4c2fd4f6369067965017aeea18ba68b1f658344d /new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux | |
parent | 9bf491a18e4b772505c3767cf0249eb24f0a822b (diff) |
- Initial Lua backend implementation.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux new file mode 100644 index 000000000..c322e5005 --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux @@ -0,0 +1,42 @@ +(.module: + lux + (lux (control pipe) + (data [number] + text/format) + [macro "meta/" Monad<Meta>]) + (luxc (lang (host [lua #+ Lua Expression Statement])))) + +(def: #export translate-bool + (-> Bool (Meta Expression)) + (|>> %b meta/wrap)) + +(def: #export translate-int + (-> Int (Meta Expression)) + (|>> %i meta/wrap)) + +(def: #export translate-nat + (-> Nat (Meta Expression)) + (|>> (:! Int) %i meta/wrap)) + +(def: #export translate-deg + (-> Deg (Meta Expression)) + (|>> (:! Int) %i meta/wrap)) + +(def: #export translate-frac + (-> Frac (Meta Expression)) + (|>> (cond> [(f/= number.positive-infinity)] + [(new> "math.huge")] + + [(f/= number.negative-infinity)] + [(new> "(-1 * math.huge)")] + + [(f/= number.not-a-number)] + [(new> "(0/0)")] + + ## else + [%f]) + meta/wrap)) + +(def: #export translate-text + (-> Text (Meta Expression)) + (|>> %t meta/wrap)) |