Ask Experts » General Questions » Other Questions »

What is jython, cpython, ironpython etc?


Date: 03 Mar 2016   Posted By: sudarmani s     Group: General Questions    Category: Other Questions   

Hi, I see there are many implementations of python which itself was written in C. What does it mean to write a programming language in another programming language? How does a programming language written in a procedural language like C get such OOPS features?

If python is written in C, in which language C was written in? And in which language java was written in? Please tell me the hierarchy of the execution of a programming language?

I know a computer understands only 0's and 1's? Then how these programming languages are executed, some interpreted and some compiled?

If I want to write my own programming language where should I start? What should I learn?


If you want to know the basic knowledge on jython, cpython, ironpython etc, ask our experts for their best opinions.


Author: Mahesh    03 Mar 2016      Member Level: Diamond     Points : 15  (Rs 15)    Voting Score: 0

Here are the answers to your questions.

1. CPython is an implementation of Python. It basically compiles C code from python code. There are instances where you want low level code such as C or C++ instead of interpreter based language like python. That's where C comes in for Python. Python doesn't entirely use C classes or methods. It only uses C for machine level conversion and system access. OOP in languages such as python and Ruby are entirely designed in their own architecture. It has nothing to do with C. And C is not at all OOP based. C++ is OOP based and python and Ruby don't make use of C++ core in their architecture.

2. OOPS features in Python are not because of C. Those features are part of Python's own set of classes and interpreter. C only provides IO and Network level code support. In such scenarios C is used within python interpreter.

3. Hierarchy is something like this - low level languages that compiles the machine level code directly. Fortran, Basic used to be such languages in past. Then comes compiler level languages which compiles into machine level code and then run over machine. And then there are byte code level languages such as Java. In case of java the process is compiling code into byte code and then byte code executes machine level compiled code. And then there are interpreter based languages like python ruby and scala. Think of this hierarchy as - low level code - > machine level code -> compiler code - > interpreter level code.

For example Scala is based on JVM interpreter and it compiled to bytecode that runs from java virtual machine. In case of .NET there are .NET based languages like VB, C# and F# etc.

Jython is java implementation for python so that it can run on java virtual machine and compiles into byte code.

Ironpython is .NET implementation for python so that it can execute .NET specific subroutines and classes and compiles into .NET byte code.

4. Machine level code are into low level coding and those executed along with the kernel. In case of code that calls machine level code they can be compiled or interpreter level.

5. If you want to design your own programming language, first you have to pick either machine compiled or interpreter level language. You have to study it's internals first. Once you understand internals, then you have to understand how it was compiled from source. And once you understand how language can be compiled from source, you can then start creating your own based on either machine compiled or interpreter based implementation.

In order to write your own language, you need to understand low level languages or even compiled level such as C. If you don't want to waste much time designing from scratch then you can learn byte code interpreters such as Java or .NET. On books front, you can read about compiler, data structures and algorithm. These should be more than enough to give you understanding of how to read the source code of any language.

Learn about LLVM compiler here : http://www.llvm.org/

Open Github account and start reading .NET core if you want to design a programming language quickly in .NET. Same goes for java if you want to use JVM for your interpreter based language.

You can find more interesting discussion here : https://www.quora.com/How-do-I-create-my-own-programming-language-and-a-compiler-for-it





Post Answer



You must Sign In to post a response.


Post Answer        





Related Questions
  • Return to Question Index
  • Ask Question to Experts


  • Top Contributors
    TodayLast 7 Daysmore...