13 October 2006

Scripting Languages

At work I use a proprietary scripting language written using a version of Lex and Yacc (the neat Windows implementation from Bumblebee Software called Parser Generator 2). Unfortunately it is not as well documented as I would like (although it is in a much beter state with some recent work), and also difficult to maintain. It has been fun messing around with Lex and Yacc, but Parser Generator 2 hasn't been updated since 2003 so I had to spend some time getting it ready for Visual Studio 2005 (I don't know what will happen for 64 bit...)

Admittedly this is not an ideal situation, but when this macro language was first dropped in there was not quite the thriving community of different scripting languages available. I find the whole scripting language thing intensely interesting, so I thought I'd ruminate on a few.


Python is well-known, mature and well respected programming language. It was designed as a programming language not a scripting language so it has a really solid foundation, as it is always harder to retrofit complexity rather than preparing for it at the start. It has been used in the web domain extensively as well as embedding and a programming language in its own right.

It is really extensible with a well defined C API, and also this API allows you to embed an interpreter within your program. There are arguments that you should extend and not embed Python as a language, but this is a moot point as the design of your program will normally dictate the course you take.

Extending the language with your own C++ functionality is almost trivial thanks to projects like Boost Python and SWIG. There are also many other tools for extending and embedding. I am definitely a big fan of Boost Python after success playing with it and understanding how it all fits together (and I don't forget I promised to go into more detail on setting it up and designing your program around it).

Python extensions also include the absolutely brilliant wxPython which exposes the wxWindows library. The thing about wxPython is that it is widely regarded as a better API than the actual macro based wxWidgets C++ API.


This was designed as a scripting language. It is lightweight and fast. The language has grown to accomodate the features people wanted or needed, and the community around it is massive and thriving. It is normally the option people go for when they consider Python too "heavyweight", and as such is popular with game developers (for instance the MMORPG Worlds Of Warcraft).

This language also has an excellently designed way of binding C++ to the language called LuaBind. This is born from the same roots as the Boost Python design, there are plans afoot for the Boost Langbinding project (which would also encompass binding to other languages like Ruby).

There are also many other tools and more available from the community, make sure you take a look at the wiki.


I must admit I have been keeping an eye on this project. It was born from someone's frustrations with Lua and they created their own language. It's a young language, but it is surprisingly robust and mature for its age. The active maintenance also means that it is always working for the latest compilers.

Since it is so new it does lack the size of community, but it does have some nice tools. Squirrel has a C++ language binding tool like LuaBind and Boost Python called SqPlus which is never normally far behind the release of Squirrel. I recommend going to have a look at the Squirrel Wiki for a lot more information.

Well, that is three languages so far. Others include AngelScript, GameMonkey, XHed, EO scripting language, Guile, Javascript, Ruby, Pawn, io, and no doubt I am missing some others. (I've deliberately missed off the CLI based ones.)