Galcon Games
Phil Hassey - game dev blog
Phil Hassey as Snidely Whiplash
"You can't buy awesomeness.
You're born that way."

64k “tinypy” keeps plugging along …

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:

  • Access to members is like lua / javascript. x["y"] and x.y mean the same thing.
  • 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.

Notable similarities:

  • Language contains separate list and dict types. I thought about doing like lua / javascript / php and having a single type, but it just didn’t feel right.
  • 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.

3 Responses to “64k “tinypy” keeps plugging along …”

  1. Tim Gilbert Says:

    Hi Phil…

    This sounds really interesting. I’d definitely like to check out the code, but I’m getting an error trying to do an svn checkout, to wit:

    “Error: Can’t connect to host ‘www.imitationpickles.org’: No connection could be made because the target machine actively refused it.”

    I’m also seeing a 404 just trying to browse to the URL. For a while I thought it might be my work firewall to blame, but proxying to my home network still gives me the same result. Any ideas?

  2. philhassey Says:

    Tim – are you using the svn:// protocol? I know a few people who’ve been able to check it out without any trouble …

  3. Larry Bugbee Says:

    Hi Phil,

    Should you need any more motivation…. I can see a use in small, embedded systems, like robotics. …”near” real-time applications. 64K has my attention.

    Larry


Galcon   Watermelons   Dynamite   The Hairy Chestival
All content of imitation pickles (c) 1999-2008 - Phil Hassey  "we care"