64k tinypy - now with list comprehensions and fancy arguments
Wednesday, January 16th, 2008Well, I got two of my favorite python features added in - list comprehensions [x*x for x in range(1,5)] and fancy arguments test(1,2,a=3,*c,**d).
Adding list comprehensions was painless, took only a few minutes. The arguments change was rather difficult because I had to add more rules to the parser, change how the bytecode was outputted, and rework all the internal calling stuff in the VM. Now every function takes a single argument of type ‘params’ which can contain all the details of a call.
I’ve also added in better error handling. Errors print out a backtrace of the function calls and lines of code. This is making debugging everything much easier.
I’m also finding that the more features I add, well, the slower things get. I’m also coming up against my 64k limit, so I’ve moved my tests out of the core code into a separate tests.py file to ensure that I don’t “trim down the tests” to give myself more space
The tests I’ve made have been invaluable in making it possible to do big changes fairly quickly.
Next on the agenda - either bootstrapping, or making a game with it
For the brave: svn://www.imitationpickles.org/tinypy/trunk ; python tests.py ; ./run_julia_o3 (not very fast)
