Note: I agree with everyone else here, that you really should just re-write your program from scratch. This answer is just an idea, that I hope someone will look into really.
There are already a few Ruby-to-X converters that could you could bootstrap. The good ones already have a lexer & parsers, so you'd only need to work with the backend. If you choose a language similar to Lua then you could simplify things even more.
For example, there are a few Ruby-to-Javascript implementations, like RubyJS. Putting aside metamethods, self
syntactic sugar, library differences, and a few semantic differences here and there, Lua could be seen as a subset of Javascript with a more verbose syntax.
With that in mind, you could modify most of the backend generator by changing a few {
}
s here and there:
// some random js
while(x < 56 && y == 40) {
print('Hello World!');
}
-- What you could make it generate:
while x < 56 and y == 40 do
print 'Hello World!'
end
Perhaps there may be a few times when it relies upon Javascript specific features, but even then, most of them could be emulated.
// Javascript has a === operator that enforces type equality
'5' === 5 // FALSE!
-- Lua lacks this, but it's easy to imitate
(type('5') == type(5)) and ('5' == 5)
No, honestly, this wouldn't be an easy project, but I think it's something definetly worth investing the time in. I hope this helps! :)