Wednesday, July 30, 2008

Pair #1

Finally, I'm putting up what I have for Pair, my script language intended for homebrew game projects. Pair is designed to be a small, embedded, acceptably fast (probably not yet the case) script language that will ultimately allow multiple concurrent VM (and not OS-based) threadlets, generators and continuations.

I don't have a lot of time on my hands, so stuff like this takes quite a long while. Now, there's some messed up stuff going on here. You'll have to forgive me that or wait until it's refined more. For example, scoping isn't right at all. The (let ..) expression isn't how it's supposed to be in a lisp-type language. It defines a variable for the rest of the outer scope which isn't right. I'll fix that. Continuations aren't currently supported, but the underlying machinery is mostly there as well as the mechanism for running multiple lightweight VM threads although this is not accessible from the command line program. Which is probably good, since I'm not sure how well that works with the garbage collector at this point. Also, there's a lot of just general messiness going on. There are a bunch of warnings at compile time and comments are sparse. These things will be fixed eventually. I've compiled these with Visual C++ .NET 2003. There are two parts here.

Version 0.01.00

The Pair Compiler
The Pair VM

See the Code Use Policy if you are interested in using any of this for your own purposes.

2 comments:

Nick said...

I like how you've structured the DLL import mechanism, it looks clean. The flipside of that is that it seems to position Pair closely with Windows. It looks to me like Pair could be more pleasant than a lot of solutions like Tcl for making quick tools.

I'd be curious to see how you would support generators and microthreads with the Pair syntax?

Paul Senzee said...

Nick, thanks for checking it out! :)

Pair is currently closely aligned with Windows when it comes to native function calls.

For microthreads, I may use a future type idiom like in Scheme. As one element to handling these types of things, there's a yield opcode which can be compiled in automatically (for the cooperative microthreads) or invoked specifically as (yield). Regarding generators, I still haven't considered how to handle the passing of values syntactically.