I have built two very small pythons (pymite and tinypy) where one is not maintained anymore. The following summarises the experience.
pymite
I found the most recent version :
https://github.com/dwhall/p14p
It is a Python for microcontrollers. I don't have one, so I will build it for my Windows 10, with an Ubuntu installed from Microsoft store.
I downloaded the archive as a zip file, unzip it into the directory p14p-master. I type 'make' to build it.
I get some error about comparing pointer to int. To fix this, I locate -Werror in the Makefile
pymite requires Python 2.6 (the project have been inactive for some time). I don't want to replace my existing Python with Python 2.6 by installing it, therefore I download Python 2.6 from the source:
https://www.python.org/downloads/ and place it in the newly unpacked p14p-master directory
I unpack it, go into the directory, then type:
I note the location of my newly built python.exe file, i.e., /p14p-master/python2.6/python.exe, then I go into each of the python files in the tools directory and replace #!/usr/bin/env python with /p14p-master/python2.6/python.exe in each .py file in the pymite project. I type make, go to the directory in p14-master/src/tools/ and type:
- ./ipm.py -f ../platform/desktop64/pmfeatures.py -d
Now you could type: print "hello world"
it is a bit annoying to type stuff directly to stdin, so if we have a python file, say "test1.py" with a python program, you could type :
from within pymite to load and execute the test1.py.
It seems that it doesn't contain a parser and takes the bytecodes from my python 2.6 program (i.e., the .pyc) file and execute them so one could argue that pymite is more a virtual machine.
tinypy
It can be found here:
http://www.tinypy.org/downloads.html
build it by downloading the zip file, unzip it, then type:
it runs several test, and explain that you could run python programs like this:
(it doesn't seem to allow you to type in directly into stdin, so you need to store your program into a file)
A statement such as print "hello world", doesn't output anything, however changing it to print("hello world") does. So I guess tinypy was more inspired by Python 3, while pymite was inspired by Python 2.