Python language spec

Thomas Wouters thomas at xs4all.net
Mon Jan 3 03:48:52 EST 2000


On Sun, Jan 02, 2000 at 08:15:18PM -0600, Nolan Darilek wrote:

> I have a long-standing tradition of taking up personal projects in
> which I bite off much more than I can chew. The end result is that
> several weeks later I emerge with a bit more knowledge, and either a
> semi-working product or much less hair on my head. :) My most recent
> attempt is a Python interpreter written to compile a subset of Python
> into Muq (http://muq.org/~cynbe/muq/) bytecodes for execution natively
> on the server platform.

Not to spoil your fun at playing with yacc & parsing python, but you dont
really need to tackle yacc/parsing yourself to embed an interpreter. Are you
sure you want Muq to take on only a subset of Python expressions, and not a
subset of python builtin modules/functions ? If the latter, you dont need to
do any parsing, you can build a modified __builtins__ namespace and execute
user code in that. 

Markus Stenberg wrote a small patch to embed Python into TinyMUSH 3.0 and
provide basic MUSH functionality to the python code being executed. It's not
up to date, having been written for TinyMUSH 3.0 beta 5, while beta 19 is
the current version, and i doubt you can cut&paste it into Muq in any case,
but the main function is 1 600 line file, which demonstrates at least one
way to limit access to Python libraries.

Of course, if you really want to tackle python code directly, for instance
to avoid common problemns like 'a.apped(b);b.append(a)' and 'while 1:
pass', the patch can't be more than a small hint. If you do that, though,
keep me posted, i've been wanting to work around those problems for a long
time, for embedding purposes, and have only been lacking time to do so ;P

mushi-mushi-ly y'rs,

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list