compiling to python byte codes

Jeremy Bowers jerf at
Sat Sep 4 20:43:11 CEST 2004

On Fri, 03 Sep 2004 09:42:58 +0200, Martin v. Löwis wrote:

> Maurice LING wrote:
>> I dont't quite get this right. Since x86/PPC uses register operations, 
>> why do virtual machines, like python's and java's, are designed as stack 
>> machines? Why not just stick to registers?
> I really think you should study programming language implementations
> for some time before approaching your problem.

With respect Maurice, I think I have to agree on this.

In your situation, I can promise you that it is *faster* to take the time
to learn about this stuff correctly then to try to power through it
without learning; it is one of those places in computer technology
where there are such powerful tools to help you that it is better to
learn how to use them then to kludge through. Unfortunately, it is too
large a topic to cover in a Usenet posting. 

If your institution offers a compilers class (a sadly diminishing number),
try to take or audit that. (You most likely don't want a *compiler*, but
an *interpreter*; the course will explain the difference. An interpreter
typically uses much the same technology to implement, parsers and abstract
syntax trees and such, but is usually much easier to implement.)  (I think
you hinted this was thesis project, hence this suggestion. Failing that,
you may need a compilers book and some self-study time. Again, I promise
you this is faster almost immediately than trying to power through this
without it.)

If you are responsible for creating the opcodes directly, you may find a
better way to do what you are doing anyhow. Assembly is easy to implement
but (with apologies to the more experienced among us) sucks to program in.

Stepping up a level, are you sure you can't just implement a C or Python
library and let people write their own programs in Python? You'll never be
able to match Python-the-language's feature set. 

More information about the Python-list mailing list