is Python/R/Ruby written in C?

The notion that a programming language written in another programming language is a bit weird, Usually people say Python/Ruby etc written in C.

I would probably say the compilers and interpreters written in C rather the whole programming language.

I’ll mostly talk about Python and Ruby here…(there are other programming languages too).

Every language has its own set of semantics to be followed to communicate with the machine, in that process if you take Ruby for a simple for statement to say hello

#!/usr/bin/ruby
for i in 1...10
    print i, " Hello\n";
end Note: `JRuby` (Say Java implemented Ruby) syntax is similar.

The same in Python (2.x style) as

#!/usr/bin/python
for i in range(10):
    print i, " Hello\n"; Note: `Jython` (Say Java implemented Python) syntax is similar.

Both the programming languages were written in C, but semantics are pretty much different. Each one has its own style of writing instructions.

Also, both the languages have other implementations too Ruby --> JRuby and Python --> Jython (there are some more implementations too). These Java implementations follow the same kind of semantics as C.

That’s the reason they are called as a language of its own, means Python/Ruby are programming languages like C.

But there should be some mechanism to convert this piece of code written English to machine understandable, that mechanism can be written in any other programming languages (C or C++, Java,…).

The whole point here is, each language is different. Saying this language is written in some other language is probably not correct. The mechanism (Compiling/Interpreting) only be implemented in other languages.

Published: March 17 2017

  • category:
blog comments powered by Disqus