Refining the Ruby CIL DSL

A bit more hacking today, and I’ve got a pretty complete implementation of my Ruby CIL DSL. Highlights include the new include directive for namespaces. Except for some corner cases, I handle all of CIL right now.


require 'RbDynamicMethod'
RbDynamicMethod::create_ruby_method('say_hello') do
include  'System, System.Collections'
ldstr    'Hello, World, int = {0}, double = {1}'
ldc_i4   42
box      'Int32'
ldc_r8   3.141592654
box      'Double'
call     'static Console.WriteLine(String,Object,Object)'
br_s     'end_of_method'
ldstr    'Goodbye, World'
call     'static Console.WriteLine(String)'
label    'end_of_method'
ldc_i4_4
ret
end
RbDynamicMethod::say_hello
Twitter Digg Delicious Stumbleupon Technorati Facebook Email

No comments yet... Be the first to leave a reply!