This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <stdio.h> | |
| // return :: Monad m => a -> m a | |
| typedef void * /* m a */ return_t(void * /* a */); | |
| // type kleisli_arrow a b = a -> m b | |
| typedef void * /* m b */ kleisli_arrow(void * /* a */); | |
| // bind :: Monad m => m a -> (a -> m b) -> m b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'llvm/core' | |
| require 'llvm/execution_engine' | |
| require 'llvm/transforms/scalar' | |
| class Generator | |
| attr_accessor :ptr | |
| def build(code,name, mod) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'fiddle' | |
| require 'minitest/autorun' | |
| class RubyVM | |
| class InstructionSequence | |
| address = Fiddle::Handle::DEFAULT['rb_iseq_load'] | |
| func = Fiddle::Function.new(address, [Fiddle::TYPE_VOIDP] * 3, Fiddle::TYPE_VOIDP) | |
| define_singleton_method(:load) do |data, parent = nil, opt = nil| | |
| func.call(Fiddle.dlwrap(data), parent, opt).to_value |