Thursday, 25 April 2013

Introducing MUPLex

I've been taking one of Dan Grossman's courses on programming languages and it was one of the most illuminating I've ever taken. While teaching, he used a made up programming language called MUPL. This MUPL had higher order functions, pairs, conditionals and the addition operation - this is the bare minimum with which you can teach how to build interpreters but also enough on which you can further build a high level functional language.

MUPLEx is basically an extensions of MUPL. It adds some syntactic sugar as well as new features. Here's a list:

  • Functions with an arbitrary number of arguments
  • Currying by default
  • Mutability - yes, I know mutability is the source of all evil (most of it, at least) but in some cases it makes sense, like having lazy evaluation or memoization
  • Records - to be able to build meaningful data structures
  • More math operations
  • Letrec - the equivalent of forward declaration in C (this way you can have mutually recursive functions, or other useful constructs)
  • Cond - syntactic sugar for nested conditionals
  • Lists - syntactic sugar for nested pairs
  • A way to print out stuff
  • Booleans

It also has some primitive type checking to catch some errors as you type. But, unfortunately, at this stage the errors are not too explicit.

I can't include the interpreter in this post because it's a pretty hefty beast, but I can point you to the github HTML preview thingie or directly to the repository.
*the preview may not work in Chrome/Safary

Wednesday, 3 April 2013

Spring updates, RU invades the GPU

Spring has come! (for most at least, Sweden is actually a bit behind). So here's some spring news:

Firstly, I've updated the stochastic optimization framework. The plugin system is now fully functional - yes, you can pack your favourite algorithm into a .jar, drop it in the plug-ins folder and see how it performs. The usual bug fixes here and there also come with this update.

Secondly, I've updated and shared Particle48 on github. It's a particle systems library (for JS & the HTML5 canvas) I made a while ago for use at LD events (and I've actually used it in Homo Vermes). I expect to update it before every LD compo and add new types of particles. If I get fellow ludumers to contribute, things will really start rolling.

And last but not least, OCLEx got 2 new additions: 1. a simple demo to the bundle to show how to set things up to start doing some image manipulation on the GPU and 2. RU on the GPU - this basically means that every Executor is a separate "process" running on the GPU and doing its duty. It started as an experiment to see how one would simulate a MIMD architecture in a SIMD environment and then got disguised in a nice RU uniform. Early OpenCL capable video cards have terrible performance penalties if the kernels are not executing the same instruction. This is a big bummer if you have any sorts of branches in the kernels. With this simulation you don't get any performance penalties (everything runs slower, but it's independent of the instructions the kernels are executing). I'll come back with more details after I do some more work and prettify it. In the mean time you can find it here.

The screenshot looks like that not because it's a work in progress but because it uses the GL_UGLY texture filter.