471,071 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Re: Implementing my own Python interpreter

Ognjen Bezanov wrote:
Hello All,

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. 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?
Mostly. It is worth noting, though, that the Python bytecode is at a higher
level than Java bytecode. You can run other languages on top of the JVM using
Java bytecode (Python, for one), but Python bytecode is geared very much towards
running Python code with Python's object model.
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)
Several years ago, there was someone who wrote up such a document for a
university project. Unfortunately, my Google-fu has failed me, and I cannot find
it again.
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?
Sure. There have been a few ports to microcontrollers. For example, the
GM862-QUAD-PY cellular module has an embedded Python 1.5.2 (plus a few 2.x
features):

http://www.gm862.com/en/products/gsm...&p_ac=show&p=4

PyMite is an open source implementation for 8-bit microcontrollers:

http://pymite.python-hosting.com/

TinyPy is similar, although I don't believe it ever aimed for (or has achieved)
running OS-less:

http://www.tinypy.org/

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Oct 13 '08 #1
0 1402

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by vincent Salaun | last post: by
118 posts views Thread by 63q2o4i02 | last post: by
113 posts views Thread by John Nagle | last post: by
5 posts views Thread by Adam Atlas | last post: by
3 posts views Thread by Marcin Kalicinski | last post: by
4 posts views Thread by Ognjen Bezanov | last post: by
reply views Thread by Matt Nordhoff | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.