So .. I had a hard time resisting working on my 64k version of “python”. I’ve been able to get quite a few features into it and I’ve gotten my julia demo up to near-C speed as well as tamed the crazy memory problems I was having.
I suppose the question I ponder is “why bother”? Well:
- It’s fun
- I’m learning the basics of parsing, code generation.
- It might even be somewhat useful!
The first two don’t require much explanation, the third (usefulness?):
- By keeping the codebase < 64k, it will be readable by mortals
- By generating C code, it can build self-contained binaries easily
- It has a really simple “FFI” which auto-generates many of the “FFI” wrappers for you
- It’s sort of fast now (no promises for anything real)
It, of course, isn’t python, it just looks a bit like it. Notable differences are:
- Most infix operators only work with numbers. “x”+”y” won’t work. (Rational: makes numerical math fast)
- It’s missing (and will never have) a bunch of really nice features. Syntax checking is notably weak. Maybe I should scrap my parser, etc and just use python’s.
- No exception handling. Incorrect use of anything will result in a seg fault.
- It’s indented (duh)
- Garbage collection via libgc
Well .. that’s about it. I expect before I’m done I’ll make a game with it, to see how it works in the real world. I’ve got a few more things on my TODO list to get done first. If you are brave, check out svn://www.imitationpickles.org/tinypy/trunk and run ./run_julia (linux) to see the julia demo.
Oh, and for all you “test first” folks, I’ve (more or less) been doing that. It’s made development considerably easier. See the bottom of “pylang.py” “dumbparse.py” and “dumpout.py” for all the testing fun.