4 ms·
I did something very similar to this (though I never got to JITing to actual machine code, it was on my roadmap, and there were differences in goals[1]) back in
by stormbrew 5y ago
I did something very similar to this (though I never got to JITing to actual machine code, it was on my roadmap, and there were differences in goals[1]) back in the 1.8.x days and the reality is that writing any kind of ruby interpreter is an astoundingly complex task. It is not a simple language and it has a lot of awkward corners.
I spent months getting it to the point where it could just properly run rubyspec, and then months more just making it pass a decent number of its tests.
I can't imagine this has gotten any easier since then, it would be a hell of a project to make anything like this a complete working project.
[1] it's kind of horrifying to me now but it's still up on my github at github.com/stormbrew/channel9 -- the actual goal was a multilanguage vm where you can implement languages in themselves. It was originally written in ruby and eventually the bytecode interpreter core was rewritten in C++. The OP project is much nicer, more directed, and better documented by far than what I wrote there though.