www.digitalmars.com               DMDScript   C & C++
Last update Wed May 12 17:42:20 2010

DMDScript in C++

An alternative to the D Programming Language, implementation of DMDScript is the C++ implementation. The C++ implementation is for those applications where:

Key Benefits of DMDScript


Installing DMDScript on Windows

Download DMDScript binaries for Win32.

The C++ source code for DMDScript is available for evaluation purposes. A license is available.

Files:

dscript.dll Digital Mars' DMDScript interpreter for COM
treatas.exe Convince Explorer to run DMDScript
ds.exe Standalone console version of DMDScript
sieve.html Benchmark speed of script engine, compare for yourself!
sieve.ds Benchmark speed of standalone script engine, compare for yourself!

Installing DMDScript to run under Explorer

Explorer usually is configured to use Microsoft JScript as its ECMAscript interpreter. To configure Explorer to run DMDScript instead:
  1. Close all browser windows.
  2. Execute the following commands:
    regsvr32 dscript.dll
    treatas jscript dmdscript
    
  3. Load the web page sieve.html to verify that DMDScript is running.
  4. Try these speed tests.
It is not necessary to reboot Windows.
Note: Much of the Windows user interface outside of the browser depends on Microsoft's JScript engine, and it depends on many undocumented features of JScript. These undocumented behaviors may not work with DMDScript; DMDScript is designed to handle script embedded in web pages accessed through the browser.

Switching Explorer Back to Using Jscript

To switch back to using Microsoft JScript:
  1. Close all browser windows.
  2. Execute the following commands:
    regsvr32 /u dscript.dll
    treatas jscript
    
It is not necessary to reboot Windows.

Standalone Console Version of DMDScript

ds with no arguments will compile and run the dscript file test.ds. With an argument, it will compile & run that file:
ds sieve
will compile and run sieve.ds. The .ds is the default extension.

The console version has some additional builtin functions available:

getenv(string)
Get and return value of environment variable string.
print(string)
Print string to stdout.
println(string)
Print string to stdout followed by a newline.
readln()
Read and return an input line from stdin, not including the newline.

Differences Between DMDScript (Digital Mars), Jscript (Microsoft) and Javascript (Netscape)

goto Statement

DMDScript implements the goto label; statement, like in C. goto is not part of the ECMA 262 v3 standard.

assert() Function

DMDScript implements the assert() function property of the Global Object. assert() throws a RuntimeError exception. If there is an argument to assert(), that argument is converted to a Boolean and a RuntimeError exception is thrown if the argument is false.

__proto__ Property

Javascript supports the __proto__ property. Neither ECMA nor Jscript nor DMDScript supports it.

Conditional Compilation

JScript's conditional compilation statements are not supported by DMDScript, Javascript, nor ECMA.