By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,786 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,786 IT Pros & Developers. It's quick & easy.

Tiny/small/minimalist Python?

P: n/a
rtk
I'm looking for information on building a tiny/small/minimalist/
vanilla python interpreter. One that implements the core language and
a few of the key modules but isn't tied to any specific operating
system.

I guess I'm asking for the smallest subset of the standard Python
source code files that is necessary to get a working interpreter using
a plain C compiler.

Is this even possible? If so, has someone done it already? I've
looked on Google and in comp.lang.python but nothing comes up.

Thanks!
Ron

Jul 1 '07 #1
Share this Question
Share on Google+
14 Replies


P: n/a

"rtk" <on********@hotmail.comwrote in message
news:11**********************@o11g2000prd.googlegr oups.com...
| I'm looking for information on building a tiny/small/minimalist/
| vanilla python interpreter. One that implements the core language and
| a few of the key modules but isn't tied to any specific operating
| system.
|
| I guess I'm asking for the smallest subset of the standard Python
| source code files that is necessary to get a working interpreter using
| a plain C compiler.
|
| Is this even possible? If so, has someone done it already? I've
| looked on Google and in comp.lang.python but nothing comes up.

Google 'tinypython' and first entry is Mark Hammond's answer to nearly same
question. And some other responses might help you

Jul 2 '07 #2

P: n/a
In article <11**********************@o11g2000prd.googlegroups .com>,
rtk <on********@hotmail.comwrote:
>I'm looking for information on building a tiny/small/minimalist/
vanilla python interpreter. One that implements the core language and
a few of the key modules but isn't tied to any specific operating
system.

I guess I'm asking for the smallest subset of the standard Python
source code files that is necessary to get a working interpreter using
a plain C compiler.

Is this even possible? If so, has someone done it already? I've
looked on Google and in comp.lang.python but nothing comes up.
Jul 2 '07 #3

P: n/a
rtk <on********@hotmail.comwrites:
I'm looking for information on building a tiny/small/minimalist/
vanilla python interpreter. One that implements the core language and
a few of the key modules but isn't tied to any specific operating
system.
You've gotten good suggestions about Python configurations. Depending
on your application you might look at alternative languages as well.
Lua and Hedgehog Lisp both come to mind as small embedded interpreters.
Jul 2 '07 #4

P: n/a
Cameron Laird wrote:
In article <11**********************@o11g2000prd.googlegroups .com>,
rtk <on********@hotmail.comwrote:
>I'm looking for information on building a tiny/small/minimalist/
vanilla python interpreter. One that implements the core language and
a few of the key modules but isn't tied to any specific operating
system.

I guess I'm asking for the smallest subset of the standard Python
source code files that is necessary to get a working interpreter using
a plain C compiler.

Is this even possible? If so, has someone done it already? I've
looked on Google and in comp.lang.python but nothing comes up.
.
.
.
Tiny Python, PyMite, EmbeddedPython, Diet Python, deeply embedded
python, ...--I need to write up a page that explains these.
Python binary/exe its self dosnt include much. if you get the full build
and just remove modules, you can strip a lot out.. scripts that try
import those files just wont work.
Jul 2 '07 #5

P: n/a
rtk
On Jul 1, 10:12 pm, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
You've gotten good suggestions about Python configurations. Depending
on your application you might look at alternative languages as well.
Lua and Hedgehog Lisp both come to mind as small embedded interpreters.
PyMite will get a closer look from me eventually but I found that Lua
will fit my immediate needs quite nicely. Thanks for the suggestion.

FYI.. I wanted a simple version of Python to run on an ancient DEC
Alpha box. I got VMS Python 2.5 up and running but it is too slow to
use. It takes *minutes* to get the interpreter prompt after typing
'python'! Lua, on the other hand, compiled without changes (used the
ANSI switch) and runs nicely. I'm always up for learning a new
language anyway.

Ron

Jul 2 '07 #6

P: n/a
rtk <on********@hotmail.comwrites:
FYI.. I wanted a simple version of Python to run on an ancient DEC
Alpha box. I got VMS Python 2.5 up and running but it is too slow to
use. It takes *minutes* to get the interpreter prompt after typing
'python'!
Something is wrong. Maybe it's trying to DNS itself and timing out,
or something like that.
Jul 2 '07 #7

P: n/a
rtk
On Jul 2, 9:43 am, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
rtk <oneelkr...@hotmail.comwrites:
FYI.. I wanted a simple version of Python to run on an ancient DEC
Alpha box. I got VMS Python 2.5 up and running but it is too slow to
use. It takes *minutes* to get the interpreter prompt after typing
'python'!

Something is wrong. Maybe it's trying to DNS itself and timing out,
or something like that.
The trouble is that the Alpha is too old. VMS Python is compiled for
a newer machine with a different instruction set and the Alpha is
emulating the machine instructions it does not have (a nice feature of
OpenVMS, but of dubious value).

For my needs, the effort of recompiling all of Python wasn't worth
it. Since Lua runs under Unix it will be perfect for my project. I'm
writing a compiler for a simple language to 6502 assembly code. I've
already written one in Python for small PIC microcontrollers (see PIC0
at http://www.geocities.com/oneelkruns/) and was planning on using
Python for this compiler project as well but it will be fun to use
something new, too. I am thinking of doing most of the development in
OpenVMS, just for the heck of it.

Ron

Jul 2 '07 #8

P: n/a
Paul Rubin wrote:
rtk <on********@hotmail.comwrites:
>FYI.. I wanted a simple version of Python to run on an ancient DEC
Alpha box. I got VMS Python 2.5 up and running but it is too slow to
use. It takes *minutes* to get the interpreter prompt after typing
'python'!

Something is wrong. Maybe it's trying to DNS itself and timing out,
or something like that.
Something is definately wrong.

Back in the days my port of Python to the Commodore Amiga machine ran
quite comfortably on a 50 mhz CPU with 4 Mb of RAM. (ok ok it was
Python 1.5.2, that has to be said).
Python started in about 5 seconds on that Amiga if I remember
correctly. I'm quite sure your 'ancient' DEC Alpha box is way more
powerful than my Amiga back then.

--Irmen
Jul 3 '07 #9

P: n/a
rtk
On Jul 2, 6:26 pm, Irmen de Jong <irmen.NOS...@xs4all.nlwrote:
Back in the days my port of Python to the Commodore Amiga machine ran
quite comfortably on a 50 mhz CPU with 4 Mb of RAM. (ok ok it was
Python 1.5.2, that has to be said).
Python started in about 5 seconds on that Amiga if I remember
correctly. I'm quite sure your 'ancient' DEC Alpha box is way more
powerful than my Amiga back then.
Yes, I agree (the box in question is an AlphaServer 1000 4/200), but
the killer is the fact that the Alpha is emulating *machine
instructions* that are part of the Python image which are not part of
the instruction set of that Alpha. That's what kills performance.
When I asked about it on the VMS Python forum I was told to give my
Alpha to a museum and get a more powerful machine :)

I did look briefly at Python 1.5.2, since it is simpler, but I'm
taking the trouble I've had as an excuse to learn a new language. So
far, I'm liking Lua, save the big pet peeve of starting indices at 1
and not 0 as all sane people do. I'm currently using Python quite a
bit for other projects, so it won't be neglected.

Ron

Jul 3 '07 #10

P: n/a
Irmen de Jong <ir**********@xs4all.nlwrites:
Back in the days my port of Python to the Commodore Amiga machine ran
quite comfortably on a 50 mhz CPU with 4 Mb of RAM. (ok ok it was
Python 1.5.2, that has to be said).
Even that sounds way too slow. Kyoto Common Lisp started in a few
seconds on a Microvax-class machine, and an Alpha running Vax
emulation should be at least as fast as that. Python shouldn't have
especially worse startup overhead than KCL unless it's doing something
silly.

I'd try running Python under a profiler and figure out what's slowing
it down. I don't understand the point of developing something in Lua
on a Unix system. Lua is a cute scripting language that's easier to
embed and sandbox than Python and is smaller, but the language itself
is not nearly as nice to code in. I suggested Lua because I was
imagining some kind of memory-limited embedded application that needed
a lightweight extension language without too much of an OS interface,
and Lua is good for that. Using it to write a compiler sounds
masochistic. If there's an obstacle to using Python, I'd even
consider using KCL (or its current incarnation), which has its own
compiler (compiles Lisp to C code) among other things. It does need
several MB of memory.
Jul 3 '07 #11

P: n/a
On Tue, 03 Jul 2007 05:25:28 GMT, Dennis Lee Bieber <wl*****@ix.netcom.comwrote:
On Tue, 03 Jul 2007 02:26:43 +0200, Irmen de Jong
<ir**********@xs4all.nldeclaimed the following in comp.lang.python:
>Back in the days my port of Python to the Commodore Amiga machine ran
quite comfortably on a 50 mhz CPU with 4 Mb of RAM. (ok ok it was
....
And your's was likely more powerful than mine... I only had 2MB and no MMU
1.5.2 was great (and even more fun combined with ARexx)
How does Python combine with ARexx? Can you control applications
which provide an ARexx interface?

I stopped using my Amiga 4000/030 in 1996 or so, long before I
realized C isn't always the best choice for getting things done. I
messed around a bit with ARexx though, and while I found it neat to be
able to script an application from the inside or from the outside
using ARexx, I didn't really care for the language itself -- too
primitive for anything but the tiniest programs.

/Jorgen

--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.dyndns.org R'lyeh wgah'nagl fhtagn!
Jul 3 '07 #12

P: n/a
Dennis Lee Bieber wrote:
On 3 Jul 2007 10:03:45 GMT, Jorgen Grahn
<gr********@snipabacken.dyndns.orgdeclaimed the following in
comp.lang.python:
>How does Python combine with ARexx? Can you control applications
which provide an ARexx interface?
Irmen had supplied a Python module that had ARexx port operations.
It was not only possible to control a program with an ARexx port from your
Python programs, but it was also possible to create an ARexx host program
in Python. That is: a program exposing an ARexx command port to receive
ARexx messages. This could be done in a few lines of (python) code.

If you're interested, a bit more info is on the AmigaPython page:
http://www.monkeyhouse.eclipse.co.uk/amiga/python/

--Irmen
Jul 3 '07 #13

P: n/a
rtk wrote:
>
I did look briefly at Python 1.5.2, since it is simpler, but I'm
taking the trouble I've had as an excuse to learn a new language. So
far, I'm liking Lua, save the big pet peeve of starting indices at 1
and not 0 as all sane people do.
Hmm, that in and of itself sounds like a good enough reason for me to
check it out! I despise zero-based subscripts. If I wanted to program
in assembler then I'd program in assembler!

:-)

Frank

Jul 4 '07 #14

P: n/a
In article <46*********************@news.xs4all.nl>,
Irmen de Jong <ir**********@xs4all.nlwrote:
>Paul Rubin wrote:
>rtk <on********@hotmail.comwrites:
>>FYI.. I wanted a simple version of Python to run on an ancient DEC
Alpha box. I got VMS Python 2.5 up and running but it is too slow to
use. It takes *minutes* to get the interpreter prompt after typing
'python'!

Something is wrong. Maybe it's trying to DNS itself and timing out,
or something like that.

Something is definately wrong.

Back in the days my port of Python to the Commodore Amiga machine ran
quite comfortably on a 50 mhz CPU with 4 Mb of RAM. (ok ok it was
Python 1.5.2, that has to be said).
Python started in about 5 seconds on that Amiga if I remember
correctly. I'm quite sure your 'ancient' DEC Alpha box is way more
powerful than my Amiga back then.

--Irmen
Me, too.

I'm all for Lua--I began promoting it over ten years ago. However,
I was also working on Alphas at about that time, as well as VMS, and
of course with Python. While I don't recall that I ever had occasion
to test Python under VMS for Alpha much, I've used every other
combination quite a bit. Something's fishy about this report of a
minute-long launch-time.
Jul 6 '07 #15

This discussion thread is closed

Replies have been disabled for this discussion.