Links

Categories

Tags

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 object-oriented high-level languages like Java and C#. Unlike most scripting languages, JewelScript is statically typed.

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 static 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, arraylist and table. The language supports the definition of classes in script code and native code. It supports implementing an interface and single inheritance. It also supports multiple inheritance, while avoiding the complexity of polymorphism.

Purpose and scope of application

The main goal is to provide an extensible runtime environment with only a minimum set of predefined classes. It’s intended purpose is to be embedded into any application and be bound to that application’s native classes. JewelScript can be used to automate any application or serve as a standalone programming environment.

Conservative approach

JewelScript uses static typing, meaning variables do have a distinct type that must be specified when a variable is declared. Similar to 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 supports type-less variables.

In order to maximize compile-time checks and minimize run-time checks, the language requires variables, functions and classes to be fully declared before they can be used, but generally allows to combine 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. While value types are always passed as a copy, reference types are always passed by reference. Value types in JewelScript are the types int and float, all other built-in and user defined types are reference types.

Memory management

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 targeted at 32 and 64 bit processor architectures, it probably won’t compile and most likely won’t work on 8 or 16 bit processor architectures.

JewelScript’s core library can run on machines with memory as low as 2 megabytes, and CPUs with less than 100 MHz clock. However, the recommended minimum system spec is 4 MB of RAM and a CPU with at least 200 MHz or 50 MIPS.

State / degree of maturity

The official development status of JewelScript is stable / mature.

It is thoroughly tested on 32 and 64 bit platforms. It has been tested and proven to be working in Windows, MacOS X and Linux environments. It even runs on machines with limited resources like the Atari ST.

More information

Documentation