DWScript

November 24th, 2011

DelphiWebScript Project

See blog, the documentation, get source at GoogleCode, and view code samples at Rosetta Code.

DWScript is an object-oriented Delphi scripting language for Delphi, despite its name, it is general purpose and not limited to websites.
An extensive unit tests suite ensures high quality and robustness.

DWS allows to use as well as define whole classes (with polymorphism, meta-class and interfaces support, etc.). The scripting language is based on Delphi, but also supports syntax and features similar to Prism and FreePascal, as well as various language extensions.

Scripts can be executed from Delphi applications (in a safe, sandboxed fashion), or compiled into JavaScript that can be run client-side in a browser or any Javascript-capable engine.

  • supports classes, interfaces, records
  • supports static and dynamic arrays
  • sandboxed, automatic memory management
  • strong typing
  • type inference
  • full support for meta-classes
  • support function & methods pointers
  • contracts-programming
  • generalized “case of” and “in [...]” syntax
  • scoped, inline variable declaration
  • operator overloading
  • compound assignment operators
  • extensive exposure, declaration, inspection & debugging features
  • inline implementations of class methods
  • Automated exposure of Delphi types via RTTI
  • Optional COM/OLE capability (via COM Connector)
  • Optional RTTI direct connectivity (via RTTI Connector)
  • Optional asm capability (32 bits, via NASM)
  • Optional JavaScript code generation (compile to JavaScript)
  • etc.
type
   THelloWorld = class
      procedure Put;  // you can also implement out of line
      begin
         PrintLn('Hello, World!');
      end
   end;

var HelloWorld := new THelloWorld; // strong typing, inferred

HelloWorld.Put;

// no need to release objects thanks to GC
Comments are closed.