There was some interest here in the little language experiment I mentioned in another thread, so I'm posting a google project link here for those who might be interested in taking a look at it. http://code.google.com/p/metap/ It's just a toy at this stage written in python, but some people here might be interested in playing around with it. I don't think we should take up too much space on this board until there is at least a proof of concept for anything derived from it. It's way too general and preliminary an idea to be a serious suggestion at this stage. It's ok to email me directly. Here's what it's about in general... The idea that prompted this is my feelings that pythons byte code could be a bit higher level, and that there may be some advantages to doing that. The experiment was to see what it might look like if instead of a stack based byte code, it was a list based object code. What I ended up with is very near scheme with better support for programming in a more explicit imperative style (more like python), while still keeping both the parser and eval loop very small and simple. Example python code ...
def fact(n): ... r = n ... while n > 1: ... n -= 1 ... r *= n ... return r ... fact(3) 6
The byte code ...
dis.dis(fact) 2 0 LOAD_FAST 0 (n) 3 STORE_FAST 1 (r)
3 6 SETUP_LOOP 36 (to 45) >> 9 LOAD_FAST 0 (n) 12 LOAD_CONST 1 (1) 15 COMPARE_OP 4 (>) 18 POP_JUMP_IF_FALSE 44 4 21 LOAD_FAST 0 (n) 24 LOAD_CONST 1 (1) 27 INPLACE_SUBTRACT 28 STORE_FAST 0 (n) 5 31 LOAD_FAST 1 (r) 34 LOAD_FAST 0 (n) 37 INPLACE_MULTIPLY 38 STORE_FAST 1 (r) 41 JUMP_ABSOLUTE 9 >> 44 POP_BLOCK 6 >> 45 LOAD_FAST 1 (r) 48 RETURN_VALUE That's pretty low level. If we go to a list based model where instructions are nested lists of symbols and names, and give it better access to the frames name space, it may look like the following. Example list based code... 1 DEF "fact n" 3 [ 3.1 LET r n 3.4 LOOP 3.5 [ 3.5.1 IF (> n 1) 3.5.3 [ 3.5.3.1 BREAK ] 3.5.4 DEC n 3.5.6 LET n (* r n) ] 4 RETURN r ] That's almost python, but not quite. (Seems like a good thing to me.) It's still very simple and easy to parse by an eval loop. It's just nested sequences of symbols and names. As it turns out, this simple language would be right between python and scheme. Scheme code can be compiled to efficient C code on a wide variety of platforms including android, and i-phone. I think that may offer some interesting possibilities. I just don't want to write applications in scheme. ;-) Cheers, Ron