Creating your own scripting language

Continuing from the last post, as and when I get some time, I have been looking at a way to create a scripting engine in swift. The Obvious language of choice would be Lua but given the issues faced to get it to work with Swift, it might not be an immediate candidate.
The next alternative choice that comes to mind is JavaScript, specially since it is readily available for use as part of the Apple Libraries. This is a very commonly available library but in my opinion one that is very scarcely used. You can create in no time a scripting engine with basic functionality and expose your Swift classes for use in JavaScript.

The library that you can import into your project is JavaScriptCore and you do not need to instantiate a Web Browser to run JavaScript. The other advantage of using JavaScript is the availability of jQuery and other libraries that are quite stable. If you are interested, please keep reading as I post more updates on how that is progressing. I have a basic non OpenGL engine that can work with images, shapes and text. Things remaining are transitions and syntactic sugar for ease of use. However the initial idea was to make it a swift library as Lua was a bit painful to integrate and bind to the swift functions. Now with the JavaScript option, I shall let you know how it is going. I intent to get Lua 5.3 integrated and working but let's see.

Comments

Popular Posts