PlusScript

Introduction

PlusScript is a simple scripting language. It bases on a just in time compiler which automatically compiles a function to native machine code when it is called the first time. Afterwards, the function can be executed without much overhead, therefore the language is much faster than other "normal" scripting languages which are based on an interpreter.

Very simple example

Script file:
 function hello()
     print("Hello World!");
 end
Program to call the file:
 #include "plusscript.hpp"
 using namespace ps;
 
 // Output function
 void print(char *msg)
 {
     printf("%s\n", msg);
 }

 int main(int argc, char **argv)
 {
     VM::setLoggingOutput("plusscript.log");
     // Create VM
     VM vm;
     vm.registerBaseFunctions();
     // Register external function
     std::vector<TypeInfo> args;
     args.push_back(TypeInfo(ETC_UserPtr));
     vm.registerFunction("print", (void*)print, TypeInfo(ETC_None), args);
     // Load script file
     Module *mod = vm.loadModule("helloworld.ps");
     // Call script function
     vm.getFunction("hello").call();
     return 1;
 }

Generated on Sun Feb 3 21:38:49 2008 for libplusscript++ by  doxygen 1.5.3