Interesing project, but I wish it would show me more about what doesn't work.
The bottom of the readme indicates the list of control flow instructions it supports, but it would be convenient to have in the table the ones it doesn't as well: yield, yield from, with, try/excep, match, lambda...
Does it support "else" in loops? Does it support unpacking?
Hard to know how much Python does this Python does.
> The bottom of the readme indicates the list of control flow instructions it supports, but it would be convenient to have in the table the ones it doesn't as well
Totally true. Some people would like to contribute to the project, and knowing what's lacking is a good way to make people know how to help.
MicroPython's authors call it a "subset of python3", and that is a fairly large subset - all the familiar data structures, co-routines, module import, filesystem I/O, FFI, ...; Interpreter is much smaller than CPython and can run on a microcontroller with 256KB code/flash + 16KB RAM.
Another step down is snek, where complete interpreter code can fit in 64KB. Although, this is a much more constrained subset of python (for example - yes dictionaries, no list comprehensions): https://sneklang.org/
PikaScript appear to be even more compact at 32KB code (and is even smaller subset of the language)
There was also PyMite, for 8 bit microcontrollers with 64 KiB of program memory (flash) and 4 KiB of RAM. It supported a subset of the Python 2.5 syntax and could execute a subset of the Python 2.5 bytecodes.
But is it really Python if it doesn't have dictionaries? I'd argue No - they're the fundamental data structure of the language (like tables in Lua, arrays in FORTRAN, etc.).
Pikascript could be useful, but it seems to me it's either a castrated Python, or more positively, a minimalist embedded scripting environment with Python-like syntax. But it's not Python.
How does python even work without dictionaries? This is one of those rare times I find the word `fundamental` to be a bit understated. I mean, a class is just fancy syntactic sugar around a dict.
When you're dealing with low-level compiler tool-chains like this, it's more accurate to say they translate a subset of python syntax (or the AST) into a lower level language (either machine code, or an ASM), so the dependence on dictionaries as a implementation detail of classes/objects (or really anything else that relies on dict) isn't really there (some things may break, but that's because they rely on a particular CPython implementation detail). Well, outside of dicts themselves. Having worked with a similar system, it's really better to think of it like embedded C and write code imperatively (and no dict, just arrays/lists).
I don't see how you could support dictionaries with only 4k of memory. They're awesomely convenient but not very space efficient. Normally that doesn't matter because there's plenty of memory, but in this case it makes a lot of sense.
But yeah so much of the standard library relies on dictionaries, so it wouldn't feel very pythonic.
"A typical microcontroller used with the Moddable SDK has about 45 KB of free memory, 1 MB of Flash ROM, and runs at 80 MHz. The Moddable SDK uses many different techniques, both at build time and at run time, to work efficiently on these devices."
I was always under the impression that k is 1000 and K is 1024 ... same as with g, G or m and M. Full ack on b and B, though. Maybe the engine is indeed only 512B in RAM utilization?
Edit: Turns out the official project's claim is indeed 4KB so the title is just bogus.
So, anyone who uses Windows has probably noticed at some point that "GB" "MB" and "KB" are the power-of-2 variants. Whenever I see one of those tech YouTubers say the formatted capacity of a 1 "TB" drive is 931 "GB" I just cringe. Most storage vendors use the power-of-10 definitions and Windows uses the power-of-2 definitions. 10^12 bytes / 2^30 = 931.32, so no, formatting your drive does not make 7% of the space just disappear.
The bottom of the readme indicates the list of control flow instructions it supports, but it would be convenient to have in the table the ones it doesn't as well: yield, yield from, with, try/excep, match, lambda...
Does it support "else" in loops? Does it support unpacking?
Hard to know how much Python does this Python does.
Good luck to the project though.