Implementing my own Python interpreter

Grant Edwards invalid at invalid
Mon Oct 13 18:49:57 EDT 2008


On 2008-10-13, Ognjen Bezanov <Ognjen at mailshack.com> wrote:

> I am a third year computer science student and I'm the process of
> selection for my final year project.
>
> One option that was thought up was the idea of implement my
> own version of the python interpreter (I'm referring to
> CPython here). Either as a process running on another OS or as
> a process running directly on the CPU.
>
> Now, I can't seem to find a decent source of information on
> the python interpreter.

You mean the virtual machine?

> I have made the assumption that Python works very much like
> Java, you have code that is compiled into bytecode, which is
> then executed in a virtual machine. IS this correct?

Yes.  There are python compilers that generate bytecode for a
variety of VMs: 

 * CPython -- Python Virtual Machine (PVM)
 * Jython  -- Java Virtual Machine (JVM)
 * Iron Python -- .Net Virtual Machine

> Is there a good source to give me an overview of Python
> internals? (I can look at the code, but I would find it easier
> to understand if I can see the "big picture" as well)

The internals of what?  One of the compilers?  The PVM?

> Also, any pro's out there willing to chime on the feasibility
> of implementing python to run directly on the hardware
> (without an underlying OS)? I don't expect 100% compatibility,
> but would the basics (branching, looping, arithmatic) be
> feasible?

I would think so.

Without any file, terminal, or network I/O, I don't see how
you'll be able to do anything useful...

-- 
Grant Edwards                   grante             Yow! I demand IMPUNITY!
                                  at               
                               visi.com            



More information about the Python-list mailing list