Announcing ObjoScript

Thanks to @Thomas_Tempelmann for taking the time to explain some of the usage of ObjoScript.

Essentially, it’s a replacement for XojoScript or any other scripting engine available to Xojo (for example Wren or Python provided by Einhugur). Some of the unique advantages that ObjoScript has over other engines are:

  1. It’s completely open source 100% native Xojo code
  2. Debuggable. This is probably the single biggest differentiator from the other engines. There is no way to line-by-line step through code written in XojoScript (for example) without adding a lot of boilerplate code mixed in with script code. With ObjoScript, you can debug it in a similar manner to how you debug Xojo code.
  3. Provides a rich (and growing) core library that is more expansive than XojoScript. For example, it has a native dictionary class that is directly accessible from the host Xojo app.
  4. Works on iOS (XojoScript does not).
  5. Multi-phase compiler that generates a parse tree as well as bytecode
  6. Stack-based VM.

As for what are its use cases, well it can be used in any app that you want to make extensible. Perhaps you want a plugin architecture for your Xojo app and you want your users to be able to write code that interacts with your Xojo app - ObjoScript can do this.

I created the language for several reasons:

  1. To show what is capable with Xojo. I think it is fair to say that if you can write a compiler and performant runtime for a new language in Xojo, you can do anything with Xojo.
  2. To teach others about how programming languages work.
  3. To use in my own application because the alternatives (such as XojoScript) were not adequate for my needs.

As for a working example, just download the main project and run the demo app. It is lovingly commented throughout and I think it’s pretty self-explanatory as to how I embed the VM and compiler into it. Also, as Thomas has mentioned, there is a comprehensive wiki on GitHub. I’m also (very slowly) going through this year’s Advent of Code competition using ObjoScript. You can see what the language looks like in my repo.

2 Likes