JewelScript
Introduction
JewelScript is a general purpose, object-oriented script language that compiles into code for a register based virtual machine. The language is quite similar to other object-oriented high-level languages (Java, C#, C++), and other C-style script languages (JavaScript, GameMonkey Script, Squirrel).
The reason for choosing a C-style syntax was to make using the language as easy as possible for a wide range of developers. The reason for choosing strong typing was to minimize the need for run-time checks, and to maximize the ability to detect programming errors at compile-time.
JewelScript has the built-in data types int, float, string, array, list, iterator, table and runtime and supports the type modifiers const, and weak. The language supports the definition of classes in both, script code and native C / C++ code, as well as single inheritance of a class from an interface.
Conservative approach
JewelScript is designed much more conservative than most other scripting languages. As already mentioned, it uses strong typing, meaning that variables do have a distinct type that must be specified when a variable is declared. Like in C++, Java and C#, values can only be assigned to a variable, when the type of the variable is compatible to the type of the value to assign, or an appropriate conversion method is available. In addition, the language allows developers to declare type-less variables and arrays. Type-less variables have the advantage that they can store values of any type. However, they also have certain disadvantages and should be used with caution.
The language aims to maximize compile-time checks to detect type mismatches or other programming errors, in order to minimize the need for time-consuming run-time checks. Because of this, the language requires the developer to generally specify more information than other script languages may require. For instance, JewelScript requires developers to fully declare variables, functions and classes before they can use them, but generally allows them to combine both declaration and definition into a single statement.
Similar to Java and C#, JewelScript distinguishes between value types and reference types when it comes to passing values to functions or assigning them to variables. While value types are always passed as a copy to functions, reference types are always passed by reference. Value types in JewelScript are currently the types int and float, all other built-in and user defined types are reference types.
Memory management
Like most other script languages, JewelScript takes the burden of freeing dynamically allocated objects from the developer. The virtual machine does this by using a reference counting mechanism for all objects allocated at run-time. This mechanism keeps track of how many variables still reference a certain value, and as soon as the value is no longer used, automatically destroys it.
To circumvent memory leaks caused by reference cycles, the language supports weak references as a means to avoid reference cycles, as well as an integrated “mark and sweep” garbage collection mechanism. Usage of the garbage collector is entirely optional.
Portability
JewelScript is a static library that can be easily embedded into a C or C++ application. It is entirely developed in ANSI C and should be portable to any platform where an ANSI C compiler is available.
The source code is exclusively targeted at 32/64 bit processor architectures at the moment, it probably won’t compile and most likely won’t work on 8 or 16 bit processor architectures.
State / degree of maturity
The official development status of JewelScript 1.0 is currently beta.