Terra Informatica Script

Terra Informatica Script (TIScript v.3.0) is a scripting engine - implementation of compiler and runtime of a scripting language.

TIScript uses well known, proven and popular language contructs of ECMAScript.

Simple engine integration. In fact there are just 4 (four) main API functions in TIScript SDK you need to know to enable scripting in your application. Principles of TIScript embedding are defined in  Integration chapter.

Fast. TIScript compiles input text into bytecodes and runs them in VM (virtual machine). Memory management is based on copying garbage collector.

Extended set of classes and objects

  • ECMAScript: Global, Object, String (extended by printf function), Array, Date, RegExp, Math and Error.
  • Extended: Stream (file and socket streams), Integer, Float and Bytes (binary data).

Script and Hypertext Preprocessor Script

TIScript supports two execution modes -  Script and Hypertext Preprocessor Script when script included inside text:

...text... <% ... script ... %> ...text...  

PHP hypertext preprocessor is using the same mode. Now you can use this technology in your application with single and simple component. See SDK/scripts/hypertext/month.html.jsp as an example of how to generate dynamicly html. SDK/scripts/hypertext/enumgen.cpp.jsp shows of how TIScript can be used as a C/C++ preprocessor.

User defined classes

TIScript allows you to define classes more "naturally" than in ECMAScript. This example defines class Message with constructor and method say:
class Message
  function this( text ) { this._text = text;  },
  function say()        { stdout.println( this.text );  }
  property text(v)      { get { return this._text; }
                           set { this._text = v; } }  
To create instance object of such class you will do the following:
var msg = new Message("Hello World!");
msg.say(); // will print Hello World!

See section Classes in TIScript Syntax chapter for more details.

Bytecodes and persistence

TIScript engine allows you to compile and store your code into bytecodes. You may choose to store such bytecodes as a binary resource of your application and load/execute them without additional compilation phase. See description of compile and loadbc functions in Global namespace chapter.


From Wikipedia:

"Persistence describes a capability used by a computer programmer to store data structures in non-volatile storage such as a file system or a relational database. Without this capability data structures only exist in memory, and will be lost when a program exits. Persistence allows, for example, a program to be restarted and reloaded with the data structures from a previous invocation of the program."

TIScript supports two models of object persistence: binary and textual persistence.

  Binary Textual
format: Stores data in binary form. More compact representation. Stores data in textual, human readable form. Use this format if you have plans to modify persisted data in text editor.
functions: store and fetch in Global namespace. eval in Global namespace and Stream.printf("return %V;", obj), see printf in Stream chapter.
samples: /scripts/persistence/binary.js /scripts/persistence/textual.js

Textual persistence is also known as JSON interchange format widely used in AJAX.

TIScript code is derived from my C-SMILE scripting engine published at: http://c-smile.sourceforge.net .