473,225 Members | 1,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Tiny/small/minimalist Python?

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
14 5558

"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
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dave Brueck | last post by:
Below is some information I collected from a *small* project in which I wrote a Python version of a Java application. I share this info only as a data point (rather than trying to say this data...
2
by: Sven Kobow | last post by:
Hello, I'm not yet a python programmer but a python user. I faced a problem with tiny fonts in a wxPython app on a GNU/Debian system. Under Gentoo Linux the fonts are displayed in a normal...
0
by: Lucas Correia Villa Real | last post by:
Hello, I'm working with an ARM cpu which has only 64MB of flash memory available for storing applications. This system is running with an X server, some office applications and now I need to...
10
by: borges2003xx | last post by:
Exists some tool, programs or some able to compute the minimal regular expression, namely ,taking a series of regular exoression, the minimal one that makes the same matching? thanx in advance
4
by: Kinsley Turner | last post by:
Hey-ho, I'm getting a bit out of my depth porting the 'tiny encryption algorithm' from C to python. Ref: http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm...
5
by: soeren | last post by:
Hello, two days ago I stumbled across a very strange problem that came up when we were printing tiny double numbers as strings and trying to read them on another place. This is part of an object...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
31
by: melinama | last post by:
Hello, I've looked through alt.html and this group for an answer to my question. However, I found only cranky arguments with, occasionally, bits of hard-to-understand code - out of context -...
10
by: Chris Thomasson | last post by:
Here is the example code: - http://appcore.home.comcast.net/vzoom/example/interface.zip which is an analog of the following technique: -...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.