October 16, 2014comments

PikaScript is a small interpreting C-style scripting language implemented with modern C++ programming techniques (C++03). The source code for PikaScript is very compact. It’s core is around 1000 lines of C++ plus an additional header file of 500 lines including doxygen comments. The optional standard library (written in PikaScript), providing utilities for strings, math, algorithms and objects (including a mark and swipe garbage collector) is around 300 lines of source code Despite it’s small size the language is powerful enough to support sophisticated concepts such as higher order functions and closures.

I originally wrote PikaScript in 2008 for driving the GUI in Synplant. Today we use it for everything between generating beats in Patternarium to managing our internal distributed build system. You can also extend our flagship product Microtonic with custom PikaScripts. The language has withstood the test of time well with only a few minor bug fixes and no syntax changes over the past six years. The code is very portable as it strictly uses standard C++ library features only.

Goals of PikaScript

  • Compact bug-free implementation in modern C++.

  • Easy to interface with host code. E.g., all variables are represented by C++ strings.

  • 100% interpreted. No compilation pass required, just load a string and run.

  • Minimalistic language syntax. E.g., all statements counts as expressions and return values, eliminating redundant operators such as ? : (instead if may be used inside expressions).

  • Extremely dynamic with full run-time reflection of variables, code and even stack. (Making it possible to actually write debuggers in PikaScript.)

  • No heap and no need for memory management (explicit or implicit). The only dynamically allocated entity in PikaScript is the variable. E.g., a vector is a number of variables linked by name only.

Non-goals of PikaScript

  • Speed. PikaScript is slow, no doubt about that. Even with the optional quicker string class it will never be able to compete with compiled languages.

  • Small memory footprint. PikaScript can eat memory like a horse, especially if you use standard STL maps and strings for variable storage (which is the default configuration).

  • Object-orientation. You can create and use objects in PikaScript, but it is a secondary language contruct created without explicit support from the language syntax.


Google Code: https://code.google.com/p/pikascript/

Documentation: http://nuedge.net/pikascript/docs/PikaScript%20Documentation.html