Is there a real thing that can convert ruby scripts to c codes?

  • Thread starter Magicloud Magiclouds
  • Start date
M

Magicloud Magiclouds

Dear all,
As I read ruby's code, I think it is possible to convert ruby
scripts to c codes. But I searched on www.rubyforge.org, and got two
tools which do not do real convertion. By real convertion, I mean to use
c like "extend ruby with c".
The benifits, I think, are more easily interacting with libs writen
by c, especially something like glib or qt. And more stable, e.g.
rcairo, is very unstable.

Thanks.
 
S

Stefan Mahlitz

Magicloud said:
Dear all,
As I read ruby's code, I think it is possible to convert ruby
scripts to c codes. But I searched on www.rubyforge.org, and got two
tools which do not do real convertion. By real convertion, I mean to use
c like "extend ruby with c".
The benifits, I think, are more easily interacting with libs writen
by c, especially something like glib or qt. And more stable, e.g.
rcairo, is very unstable.

Do you mean something like this:

http://www.onlamp.com/pub/a/onlamp/2004/11/18/extending_ruby.html

or this:

http://www.rubyinside.com/how-to-create-a-ruby-extension-in-c-in-under-5-minutes-100.html

I do not know how accurate this is - but maybe this gives you a start.

Stefan
 
L

Lloyd Linklater

Magicloud said:
Dear all,
As I read ruby's code, I think it is possible to convert ruby
scripts to c codes. But I searched on www.rubyforge.org, and got two
tools which do not do real convertion. By real convertion, I mean to use
c like "extend ruby with c".
The benifits, I think, are more easily interacting with libs writen
by c, especially something like glib or qt. And more stable, e.g.
rcairo, is very unstable.

Thanks.

I think that this would be an immense and thankless task. If you were
to write code that was near C in syntax it might be easier.

e.g.

for i in 0..10 do
puts 'blah'
end

but when it is

"5".to_i.times do
puts 'blah' #note the different quotation marks used interchangably
end

it is more cryptic. Add the oddities of hashing and the like and the
task becomes HUGE and thankless.

In short, do not expect to see one anytime soon.
 
M

Magicloud Magiclouds

Kyle said:
Isn't there ruby2c by zenspider?
Yes, that is almost what I wanted, but RubyToC is not complete now, many things that does not support....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top