aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2021-11-29 16:21:32 -0400
committerEduardo Julian2021-11-29 16:21:32 -0400
commitbd6ff5014b4d9fad6c6fa6ab3a2e30fc768687e1 (patch)
treefa87da363df4f1da39226a134ad137d648291368
parentcf72ee2b6c8fe87e43f3e6553fcb13588fb560a3 (diff)
Ruby compilation that is better adjusted to both normal Ruby and MRuby.
-rw-r--r--documentation/bookmark/architecture.md1
-rw-r--r--documentation/bookmark/cryptography.md71
-rw-r--r--documentation/bookmark/memory_management.md1
-rw-r--r--documentation/bookmark/music.md10
-rw-r--r--documentation/bookmark/optimization.md4
-rw-r--r--documentation/bookmark/type_theory/dependent.md1
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux251
8 files changed, 196 insertions, 145 deletions
diff --git a/documentation/bookmark/architecture.md b/documentation/bookmark/architecture.md
index 66449caf8..d7b2a9ccf 100644
--- a/documentation/bookmark/architecture.md
+++ b/documentation/bookmark/architecture.md
@@ -1,4 +1,5 @@
# Reference
+1. [Polylith](https://polylith.gitbook.io/polylith)
1. [Awesome Software Architecture](https://mehdihadeli.github.io/awesome-software-architecture/)
diff --git a/documentation/bookmark/cryptography.md b/documentation/bookmark/cryptography.md
index f86e70ccb..0ac7ce947 100644
--- a/documentation/bookmark/cryptography.md
+++ b/documentation/bookmark/cryptography.md
@@ -1,61 +1,62 @@
# Constant-time programming
-1. [Constant-Time WebAssembly](https://github.com/PLSysSec/ct-wasm)
-1. [Verifying Constant-Time Implementations](https://michael-emmi.github.io/papers/conf-uss-AlmeidaBBDE16.pdf)
-1. https://www.bearssl.org/ctmul.html
-1. [FaCT: A Flexible, Constant-Time Programming Language](https://cseweb.ucsd.edu/~dstefan/pubs/cauligi:2017:fact.pdf)
-1. [FaCT: A DSL for Timing-Sensitive Computation](https://ranjitjhala.github.io/static/fact_dsl.pdf)
-1. ["FaCT: A New Language for Constant-Time Programming" by Sunjay Cauligi](https://www.youtube.com/watch?v=kbn9UCRK2Qg)
+0. [Constant-Time WebAssembly](https://github.com/PLSysSec/ct-wasm)
+0. [Verifying Constant-Time Implementations](https://michael-emmi.github.io/papers/conf-uss-AlmeidaBBDE16.pdf)
+0. https://www.bearssl.org/ctmul.html
+0. [FaCT: A Flexible, Constant-Time Programming Language](https://cseweb.ucsd.edu/~dstefan/pubs/cauligi:2017:fact.pdf)
+0. [FaCT: A DSL for Timing-Sensitive Computation](https://ranjitjhala.github.io/static/fact_dsl.pdf)
+0. ["FaCT: A New Language for Constant-Time Programming" by Sunjay Cauligi](https://www.youtube.com/watch?v=kbn9UCRK2Qg)
# Zero-knowledge proof
-1. ["Rhapsody in Zero Knowledge: Proving Without Revealing" by Tony Arcieri](https://www.youtube.com/watch?v=jKSz7W5dTgY)
-1. [Zero-Knowledge Proofs: What are they, how do they work, and are they fast yet?](https://zkp.science/)
+0. ["Rhapsody in Zero Knowledge: Proving Without Revealing" by Tony Arcieri](https://www.youtube.com/watch?v=jKSz7W5dTgY)
+0. [Zero-Knowledge Proofs: What are they, how do they work, and are they fast yet?](https://zkp.science/)
# Hash
-1. [On future-proof cryptographic hashes](https://pascalprecht.github.io/posts/future-proofed-hashes-with-multihash/)
+0. [On future-proof cryptographic hashes](https://pascalprecht.github.io/posts/future-proofed-hashes-with-multihash/)
# Library
-1. [aykxt/crypto](https://github.com/aykxt/crypto)
-1. [zinc: Introduce minimal cryptography library](https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux.git/commit/?h=zinc)
-1. https://joshlf.com/post/2018/11/06/introducing-mundane/
-1. https://github.com/akhawaja/ecc-crypto-helper
-1. [Introducing CIRCL: An Advanced Cryptographic Library](https://blog.cloudflare.com/introducing-circl/)
+0. [Crypto++ Library](https://cryptopp.com/)
+0. [aykxt/crypto](https://github.com/aykxt/crypto)
+0. [zinc: Introduce minimal cryptography library](https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux.git/commit/?h=zinc)
+0. https://joshlf.com/post/2018/11/06/introducing-mundane/
+0. https://github.com/akhawaja/ecc-crypto-helper
+0. [Introducing CIRCL: An Advanced Cryptographic Library](https://blog.cloudflare.com/introducing-circl/)
# Criticism
-1. [Fuck RSA](https://blog.trailofbits.com/2019/07/08/fuck-rsa/)
+0. [Fuck RSA](https://blog.trailofbits.com/2019/07/08/fuck-rsa/)
# Reference
-1. [Sunjay Cauligi - Constant-time crypto programming with FaCT](https://www.youtube.com/watch?v=SSEHF_u79e4)
-1. https://blog.acolyer.org/2018/07/06/oblix-an-efficient-oblivious-search-index/
-1. https://cryptography.pizza/
-1. [HACL∗: A Verified Modern Cryptographic Library](https://eprint.iacr.org/2017/536.pdf)
-1. [How to Use Java Cryptography API Securely](https://www.youtube.com/watch?v=3HIdaSgxMlo)
-1. [A Graduate Course in Applied Cryptography](http://toc.cryptotextbook.net/home)
-1. https://github.com/InstantWebP2P/tweetnacl-java
-1. https://github.com/kevinburke/nacl
-1. https://github.com/miracl/MIRACL
-1. https://github.com/open-quantum-safe/liboqs
-1. https://www.bearssl.org/bigint.html
-1. https://timtaubert.de/blog/2018/08/bitslicing-an-introduction/
-1. [CT-Wasm: Type-Driven Secure Cryptography for the Web Ecosystem](https://arxiv.org/abs/1808.01348)
-1. https://arstechnica.com/information-technology/2013/10/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/
-1. https://medium.com/@dbkats/a-gentle-introduction-to-attribute-based-encryption-edca31744ac6
-1. https://cryptoswift.io/
+0. [Sunjay Cauligi - Constant-time crypto programming with FaCT](https://www.youtube.com/watch?v=SSEHF_u79e4)
+0. https://blog.acolyer.org/2018/07/06/oblix-an-efficient-oblivious-search-index/
+0. https://cryptography.pizza/
+0. [HACL∗: A Verified Modern Cryptographic Library](https://eprint.iacr.org/2017/536.pdf)
+0. [How to Use Java Cryptography API Securely](https://www.youtube.com/watch?v=3HIdaSgxMlo)
+0. [A Graduate Course in Applied Cryptography](http://toc.cryptotextbook.net/home)
+0. https://github.com/InstantWebP2P/tweetnacl-java
+0. https://github.com/kevinburke/nacl
+0. https://github.com/miracl/MIRACL
+0. https://github.com/open-quantum-safe/liboqs
+0. https://www.bearssl.org/bigint.html
+0. https://timtaubert.de/blog/2018/08/bitslicing-an-introduction/
+0. [CT-Wasm: Type-Driven Secure Cryptography for the Web Ecosystem](https://arxiv.org/abs/1808.01348)
+0. https://arstechnica.com/information-technology/2013/10/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/
+0. https://medium.com/@dbkats/a-gentle-introduction-to-attribute-based-encryption-edca31744ac6
+0. https://cryptoswift.io/
# Language
-1. https://cryptol.net/
-1. [Formally Verified Cryptographic Web Applicationsin WebAssembly](https://eprint.iacr.org/2019/542.pdf)
+0. https://cryptol.net/
+0. [Formally Verified Cryptographic Web Applicationsin WebAssembly](https://eprint.iacr.org/2019/542.pdf)
# Randomness extractor
-1. [An introduction to randomness extractors](https://cs.haifa.ac.il/~ronen/online_papers/ICALPinvited.pdf)
+0. [An introduction to randomness extractors](https://cs.haifa.ac.il/~ronen/online_papers/ICALPinvited.pdf)
# Homomorphic Encryption
-1. [Practical Homomorphic Encryption Over the Integers](https://arxiv.org/abs/1702.07588)
+0. [Practical Homomorphic Encryption Over the Integers](https://arxiv.org/abs/1702.07588)
diff --git a/documentation/bookmark/memory_management.md b/documentation/bookmark/memory_management.md
index 8a5a1c0a9..5b7510df8 100644
--- a/documentation/bookmark/memory_management.md
+++ b/documentation/bookmark/memory_management.md
@@ -22,6 +22,7 @@
# Garbage collection
+1. [Deconstructing the Garbage-First Collector](https://users.cecs.anu.edu.au/~steveb/pubs/papers/g1-vee-2020.pdf)
1. [The Garbage Collection Handbook](http://gchandbook.org/)
1. [Baby's First Garbage Collector](http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/)
diff --git a/documentation/bookmark/music.md b/documentation/bookmark/music.md
index 1e3bba2c5..d6b712fc1 100644
--- a/documentation/bookmark/music.md
+++ b/documentation/bookmark/music.md
@@ -1,12 +1,16 @@
+# Analysis
+
+0. [Three Types of Music Analysis](https://flujoo.github.io/en/three-types-of-music-analysis/)
+
# Language
-1. [alda: Alda is a text-based programming language for music composition. It allows you to write and play back music using only a text editor and the command line.](https://alda.io/)
+0. [alda: Alda is a text-based programming language for music composition. It allows you to write and play back music using only a text editor and the command line.](https://alda.io/)
# Async music
-1. [async music](https://async.art/music)
+0. [async music](https://async.art/music)
# Reference
-1. [Open Music Theory](http://openmusictheory.com/)
+0. [Open Music Theory](http://openmusictheory.com/)
diff --git a/documentation/bookmark/optimization.md b/documentation/bookmark/optimization.md
index 5ecf29694..968fd5e26 100644
--- a/documentation/bookmark/optimization.md
+++ b/documentation/bookmark/optimization.md
@@ -1,3 +1,7 @@
+# Inlining
+
+1. [Defunctionalization](https://en.wikipedia.org/wiki/Defunctionalization)
+
# Hashing
1. [Fibonacci Hashing: The Optimization that the World Forgot (or: a Better Alternative to Integer Modulo)](https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/)
diff --git a/documentation/bookmark/type_theory/dependent.md b/documentation/bookmark/type_theory/dependent.md
index abdc01942..f731e988a 100644
--- a/documentation/bookmark/type_theory/dependent.md
+++ b/documentation/bookmark/type_theory/dependent.md
@@ -1,5 +1,6 @@
# Exemplar
+1. [Mononym: Type-Level Named Values in Rust - Part 1: Demo and Implementation](https://maybevoid.com/blog/mononym-part-1/)
1. [POMPOM LANGUAGE](https://github.com/caotic123/PomPom-Language)
1. [A simple type-theoretic language: Mini-TT](http://www.cse.chalmers.se/~bengt/papers/GKminiTT.pdf)
1. https://cedille.github.io/
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
index c9136a9dd..a65557eeb 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
@@ -167,7 +167,7 @@
(_.do "remainder" (list parameter) {.#None} subject))))
(/.install "f64" (unary (_./ (_.float +1.0))))
- (/.install "char" (unary (_.do "chr" (list (_.string "UTF-8")) {.#None})))
+ (/.install "char" (unary //runtime.i64##char))
)))
(def: f64_procs
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
index 936d40b2e..af0f3338c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -1,43 +1,43 @@
(.using
- [library
- [lux {"-" i64}
- ["[0]" meta]
- [abstract
- ["[0]" monad {"+" do}]]
- [control
- ["[0]" function]
- ["<>" parser
- ["<[0]>" code]]]
- [data
- ["[0]" product]
- ["[0]" text ("[1]#[0]" hash)
- ["%" format {"+" format}]
- [encoding
- ["[0]" utf8]]]
- [collection
- ["[0]" list ("[1]#[0]" functor)]
- ["[0]" sequence]]]
- ["[0]" macro
- [syntax {"+" syntax:}]
- ["[0]" code]]
- [math
- [number {"+" hex}
- ["[0]" i64]]]
- ["@" target
- ["_" ruby {"+" Expression LVar Computation Literal Statement}]]]]
- ["[0]" /// "_"
- ["[1][0]" reference]
- ["//[1]" /// "_"
- ["$" version]
- ["[1][0]" synthesis {"+" Synthesis}]
- ["[1][0]" generation]
- ["//[1]" ///
- ["[1][0]" phase]
- [reference
- [variable {"+" Register}]]
- [meta
- [archive {"+" Output Archive}
- ["[0]" artifact {"+" Registry}]]]]]])
+ [library
+ [lux {"-" i64}
+ ["[0]" meta]
+ [abstract
+ ["[0]" monad {"+" do}]]
+ [control
+ ["[0]" function]
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" product]
+ ["[0]" text ("[1]#[0]" hash)
+ ["%" format {"+" format}]
+ [encoding
+ ["[0]" utf8]]]
+ [collection
+ ["[0]" list ("[1]#[0]" functor mix)]
+ ["[0]" sequence]]]
+ ["[0]" macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [math
+ [number {"+" hex}
+ ["[0]" i64]]]
+ ["@" target
+ ["_" ruby {"+" Expression LVar Computation Literal Statement}]]]]
+ ["[0]" /// "_"
+ ["[1][0]" reference]
+ ["//[1]" /// "_"
+ ["$" version]
+ ["[1][0]" synthesis {"+" Synthesis}]
+ ["[1][0]" generation]
+ ["//[1]" ///
+ ["[1][0]" phase]
+ [reference
+ [variable {"+" Register}]]
+ [meta
+ [archive {"+" Output Archive}
+ ["[0]" artifact {"+" Registry}]]]]]])
(template [<name> <base>]
[(type: .public <name>
@@ -67,10 +67,6 @@
..unit
_.nil))
-(def: (feature name definition)
- (-> LVar (-> LVar Statement) Statement)
- (definition name))
-
(syntax: .public (with_vars [vars (<code>.tuple (<>.some <code>.local_symbol))
body <code>.any])
(do [! meta.monad]
@@ -86,44 +82,68 @@
(def: module_id
0)
+(def: mruby?
+ _.Expression
+ (_.and (_.not (_.do "method_defined?" (list (_.string "remainder")) {.#None}
+ (_.local "Numeric")))
+ (_.do "method_defined?" (list (_.string "remainder_of_divide")) {.#None}
+ (_.local "Numeric"))))
+
+(def: normal_ruby?
+ _.Expression
+ (_.not ..mruby?)
+ ... (|> (_.local "Object")
+ ... (_.do "const_defined?" (list (_.string "Encoding")) {.#None}))
+ )
+
(syntax: (runtime: [declaration (<>.or <code>.local_symbol
(<code>.form (<>.and <code>.local_symbol
(<>.some <code>.local_symbol))))
- code <code>.any])
+ conditional_implementations (<>.some (<code>.tuple (<>.and <code>.any <code>.any)))
+ default_implementation <code>.any])
(do meta.monad
[runtime_id meta.seed]
(macro.with_symbols [g!_]
- (let [runtime (code.local_symbol (///reference.artifact [..module_id runtime_id]))
- runtime_name (` (_.local (~ (code.text (%.code runtime)))))]
- (case declaration
- {.#Left name}
- (macro.with_symbols [g!_]
- (let [g!name (code.local_symbol name)]
- (in (list (` (def: .public (~ g!name) LVar (~ runtime_name)))
- (` (def: (~ (code.local_symbol (format "@" name)))
- Statement
- (..feature (~ runtime_name)
- (function ((~ g!_) (~ g!name))
- (_.set (list (~ g!name)) (~ code))))))))))
-
- {.#Right [name inputs]}
- (macro.with_symbols [g!_]
- (let [g!name (code.local_symbol name)
- inputsC (list#each code.local_symbol inputs)
- inputs_typesC (list#each (function.constant (` _.Expression))
- inputs)]
- (in (list (` (def: .public ((~ g!name) (~+ inputsC))
- (-> (~+ inputs_typesC) Computation)
- (_.apply/* (list (~+ inputsC)) {.#None}
- (~ runtime_name))))
-
- (` (def: (~ (code.local_symbol (format "@" name)))
- Statement
- (..feature (~ runtime_name)
- (function ((~ g!_) (~ g!_))
- (..with_vars [(~+ inputsC)]
- (_.function (~ g!_) (list (~+ inputsC))
- (~ code))))))))))))))))
+ (case declaration
+ {.#Left name}
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local_symbol (format "C" (///reference.artifact [..module_id runtime_id])))
+ runtime_name (` (_.local (~ (code.text (%.code runtime)))))
+ g!name (code.local_symbol name)]
+ (in (list (` (def: .public (~ g!name) LVar (~ runtime_name)))
+ (` (def: (~ (code.local_symbol (format "@" name)))
+ Statement
+ (~ (list#mix (function (_ [when then] else)
+ (` (_.if (~ when)
+ (_.set (list (~ runtime_name)) (~ then))
+ (~ else))))
+ (` (_.set (list (~ runtime_name)) (~ default_implementation)))
+ conditional_implementations))))))))
+
+ {.#Right [name inputs]}
+ (macro.with_symbols [g!_]
+ (let [runtime (code.local_symbol (///reference.artifact [..module_id runtime_id]))
+ runtime_name (` (_.local (~ (code.text (%.code runtime)))))
+ g!name (code.local_symbol name)
+ inputsC (list#each code.local_symbol inputs)
+ inputs_typesC (list#each (function.constant (` _.Expression))
+ inputs)]
+ (in (list (` (def: .public ((~ g!name) (~+ inputsC))
+ (-> (~+ inputs_typesC) Computation)
+ (_.apply/* (list (~+ inputsC)) {.#None}
+ (~ runtime_name))))
+
+ (` (def: (~ (code.local_symbol (format "@" name)))
+ Statement
+ (..with_vars [(~+ inputsC)]
+ (~ (list#mix (function (_ [when then] else)
+ (` (_.if (~ when)
+ (_.function (~ runtime_name) (list (~+ inputsC))
+ (~ then))
+ (~ else))))
+ (` (_.function (~ runtime_name) (list (~+ inputsC))
+ (~ default_implementation)))
+ conditional_implementations)))))))))))))
(def: tuple_size
(_.the "length"))
@@ -250,27 +270,29 @@
@lux//program_args
))
-... (def: i64##+limit (_.manual "+0x7FFFFFFFFFFFFFFF"))
-... (def: i64##-limit (_.manual "-0x8000000000000000"))
-... (def: i64##+iteration (_.manual "+0x10000000000000000"))
-... (def: i64##-iteration (_.manual "-0x10000000000000000"))
-... (def: i64##+cap (_.manual "+0x8000000000000000"))
-... (def: i64##-cap (_.manual "-0x8000000000000001"))
-
-... (runtime: (i64##64 input)
-... (with_vars [temp]
-... (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>]
-... [(_.if (|> input <scenario>)
-... ($_ _.then
-... (_.set (list temp) (_.% <iteration> input))
-... (_.return (_.? (|> temp <scenario>)
-... (|> temp (_.- <cap>) (_.+ <entrance>))
-... temp))))]
-
-... [(_.> ..i64##+limit) ..i64##+iteration ..i64##+cap ..i64##-limit]
-... [(_.< ..i64##-limit) ..i64##-iteration ..i64##-cap ..i64##+limit]
-... ))
-... (_.return input)))))
+(def: i64##+limit (_.manual "+0x7FFFFFFFFFFFFFFF"))
+(def: i64##-limit (_.manual "-0x8000000000000000"))
+(def: i64##+cap (_.manual "+0x8000000000000000"))
+(def: i64##-cap (_.manual "-0x8000000000000001"))
+
+(runtime: i64##+iteration (_.manual "(+1<<64)"))
+(runtime: i64##-iteration (_.manual "(-1<<64)"))
+
+(runtime: (i64##i64 input)
+ [..mruby? (_.return input)]
+ (with_vars [temp]
+ (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>]
+ [(_.if (|> input <scenario>)
+ ($_ _.then
+ (_.set (list temp) (_.% <iteration> input))
+ (_.return (_.? (|> temp <scenario>)
+ (|> temp (_.- <cap>) (_.+ <entrance>))
+ temp))))]
+
+ [(_.> ..i64##+limit) ..i64##+iteration ..i64##+cap ..i64##-limit]
+ [(_.< ..i64##-limit) ..i64##-iteration ..i64##-cap ..i64##+limit]
+ ))
+ (_.return input)))))
(def: i32##low
(|>> (_.bit_and (_.manual "+0xFFFFFFFF"))))
@@ -295,8 +317,12 @@
i32##up
(_.bit_or @low))])
+(def: as_nat
+ (_.% ..i64##+iteration))
+
(template [<runtime> <host>]
[(runtime: (<runtime> left right)
+ [..normal_ruby? (_.return (..i64##i64 (<host> (..as_nat left) (..as_nat right))))]
(with_vars [high low]
($_ _.then
(_.set (list high) (<host> (i32##high left) (..i32##high right)))
@@ -322,6 +348,9 @@
(|>> (_.< (_.int +32))))
(runtime: (i64##left_shifted shift input)
+ [..normal_ruby? (_.return (|> input
+ (_.bit_shl (_.% (_.int +64) shift))
+ ..i64##i64))]
(with_vars [high low]
($_ _.then
(..cap_shift! shift)
@@ -340,6 +369,13 @@
)))
(runtime: (i64##right_shifted shift input)
+ [..normal_ruby? ($_ _.then
+ (_.set (list shift) (_.% (_.int +64) shift))
+ (_.return (_.? (_.= (_.int +0) shift)
+ input
+ (|> input
+ ..as_nat
+ (_.bit_shr shift)))))]
(with_vars [high low]
($_ _.then
(..cap_shift! shift)
@@ -370,7 +406,7 @@
(_.bit_shl (_.int +16)))
(runtime: (i64##+ parameter subject)
- ... (_.return (i64##64 (_.+ parameter subject)))
+ [..normal_ruby? (_.return (i64##i64 (_.+ parameter subject)))]
(let [hh (|>> i32##high i16##high)
hl (|>> i32##high i16##low)
lh (|>> i32##low i16##high)
@@ -423,12 +459,11 @@
(i64##+ (_.int +1) (_.bit_not value))))
(runtime: (i64##- parameter subject)
- ... (_.return (i64##64 (_.- parameter subject)))
- (_.return (i64##+ (i64##opposite parameter) subject))
- )
+ [..normal_ruby? (_.return (i64##i64 (_.- parameter subject)))]
+ (_.return (i64##+ (i64##opposite parameter) subject)))
(runtime: (i64##* parameter subject)
- ... (_.return (i64##64 (_.* parameter subject)))
+ [..normal_ruby? (_.return (i64##i64 (_.* parameter subject)))]
(let [hh (|>> i32##high i16##high)
hl (|>> i32##high i16##low)
lh (|>> i32##low i16##high)
@@ -477,10 +512,16 @@
)))
)
+(runtime: (i64##char subject)
+ [..mruby? (_.return (_.do "chr" (list) {.#None} subject))]
+ (_.return (_.do "chr" (list (_.string "UTF-8")) {.#None} subject)))
+
(def: runtime//i64
Statement
($_ _.then
- ... @i64##64
+ @i64##+iteration
+ @i64##-iteration
+ @i64##i64
@i64##left_shifted
@i64##right_shifted
@i64##and
@@ -490,6 +531,7 @@
@i64##-
@i64##*
@i64##/
+ @i64##char
))
(runtime: (f64//decode inputG)
@@ -556,10 +598,7 @@
(def: runtime
Statement
($_ _.then
- (_.when (_.and (_.not (_.do "method_defined?" (list (_.string "remainder")) {.#None}
- (_.local "Numeric")))
- (_.do "method_defined?" (list (_.string "remainder_of_divide")) {.#None}
- (_.local "Numeric")))
+ (_.when ..mruby?
... We're in DragonRuby territory.
(_.statement
(_.do "class_eval" (list) {.#Some [(list (_.local "_"))