Tree [30a0cb] master /

File Date Author Commit
examples 2009-09-14 nkorslund nkorslund [ca055a] Cleanup for 0.14 release
include 2009-09-06 nkorslund nkorslund [b05ef8] Rewrote modules and examples, discovered Frame ...
lib 2009-10-03 nkorslund nkorslund [30a0cb] Changed output library from libDD-monster to li...
monster 2009-09-14 nkorslund nkorslund [557197] Console fix backport from OpenMW
tests 2009-09-14 nkorslund nkorslund [ca055a] Cleanup for 0.14 release
.gitignore 2009-10-03 nkorslund nkorslund [30a0cb] Changed output library from libDD-monster to li...
GPL3.txt 2008-11-22 nkorslund nkorslund [ef5735] First sourceforge commit (at 0.10)
README.txt 2009-09-14 nkorslund nkorslund [ca055a] Cleanup for 0.14 release
codetml.d 2009-02-22 nkorslund nkorslund [5f4bba] Minor example fixing, and keywords added to cod...
dsss.conf 2009-10-03 nkorslund nkorslund [30a0cb] Changed output library from libDD-monster to li...
mvm.d 2009-09-06 nkorslund nkorslund [b05ef8] Rewrote modules and examples, discovered Frame ...

Read Me

Monster - 0.14

Written by Nicolay Korslund
Current status: alpha

Monster is currently licensed under version 3 of the GNU Public
License. License information can be found in GPL3.txt. Exceptions to
the license and copyright are noted in certain files.


To compile Monster you need a fairly recent D compiler, which you can
find at Make sure to get a compiler from
the 1.0 (stable) branch, not the 2.0 (unstable) branch. You should
also be to compile Monster with the GNU implementation of D (GDC) as
well. DMD 1.046 is specifically known to work. The LDC compiler has
not been tested with Monster yet.

To build Monster you will also need DSSS, the D Shared Software
System. You can find DSSS at:

Monster supports both Phobos and Tango standard libraries out of the
box, and the installation instructions for both are identical.

Once you have DSSS and a D compiler set up, unpack the archive file.
On linux, do:

tar xvzf monster-X.X.tar.gz

where X.X is the version number. Windows unpackers such as winrar and
7zip can also be used to unpack tar.gz files. This will create a
directory called monster-X.X. Then do:

cd monster-X.X
dsss build
dsss install

If dsss is set up correctly, the example VM (mvm) should now be in
your PATH.

Running the Examples

After compiling and installing Monster, you should be able to run the
individual example files in the examples directory. This is done with
the 'mvm' program (which should now automatically be in your PATH.)
Try the following:

cd examples/mvm
mvm hello          (or 'mvm')

Most of the example files have comments describing what they do.

There are more examples, although not as user friendly, in the tests/

Some examples produce stand-alone programs, written in D and C++.
There are three versions of each example, one for D with phobos (the
default standard libarary), one for D with Tango (alternative
library), and one for C++. See the next two sections for instructions
on how to compile and run these. The Monster files (.mn) are identical
in all three versions, and the native sources (.d and .cpp) have been
made as identical as possible. The Monster API aims to be consistent
across languages and platforms.

Compiling D Examples

To compile the D examples, do:

cd examples/phobos
dsss build
cd sdltest
dsss build

If you are a Tango user, use the examples/tango directory instead. You
must compile and install the library and main binaries (see previous
section) BEFORE you compile the examples, or else they will not
work. The example files can then be run and examined in place, you do
NOT need to run 'dsss install' in the examples directory.

The sdltest example requires DerelictSDL and libsdl. To install
DerelictSDL automatically, enter the sdltest directory and type

dsss net deps

The libSDL runtime (SDL.dll on windows) is also needed, and can be
found at or through your linux package manager.

(Note to Linux users: dsss net commands also depend on curl, which is
not installed by default on some distributions. On Ubuntu for example,
do 'sudo apt-get install curl' before using the net commands.)

Compiling C++ Examples

NOTE: These instructions are designed for a unix environment. They
will possibly work under CygWin on Windows with a few modifications,
but this has not been tested yet. Linking with Tango is not yet

Before you can run the C++ examples you have to compile the library
file in lib/ :

cd lib

This should produce the files libMonster.a and libCppMonster.a in the
lib/ directory. You also need to make libphobos.a (which comes with
DMD) accessible. For example you can put a link to it in the lib/

cd lib
ln -s /my/path/to/dmd/lib/libphobos.a .

The C++ examples can then be compiled with GNU make. Note that you
must have the SDL library and C headers installed on your system for
sdltest to compile.

Questions and comments can be sent to Nicolay Korslund
( Enjoy ;-)


A detailed and frequently updated changelog can be found at:

0.14-alpha (2009-sep-14)

- implemented function pointers (aka. delegate functions)
- all classes now inherit implicitly from 'Object'
- added 'abstract' class keyword
- various bug fixes and cleanups

0.13-alpha (2009-aug-28)

- can now use ' for string literals as well as "
- character literals no longer exist as a separate syntax
- implemented string escape sequences (\n and family)
- using "" (or '') can be used to represent a quote character in strings
- use r"..." or \"..." for wysiwyg strings (where backspaces are ignored)
- simplified function call syntax in console mode (eg. print 1 2 3)
- array literals can be implicitly cast at compile time

0.12-alpha (2009-may-04)

The changelog for 0.12 is quite substantial:
- package system tied to directories
- semicolon and other delimiters are now mostly optional
- added vm.load(), vm.loadString() etc for class loading
- script constructors
- assignment is now a statement, not an expression
- can set object variables upon creation with 'new'
- named function parameters
- optional function parameters
- initial value of class variables can changed in child classes
- initial state can be set in class declarations
- improved stack trace functionality
- enums
- module for interactive mode and ingame consoles
- new file options.d, customize the language and VM at compile time
- thin virtual file system (VFS) abstraction, allows using external
  libraries to read scripts from archives
- all initialization is automatic: InitMonster() and initAllModules()
  are gone.
- bindNew, allows a callback function for newly created objects
- explicit casting, of the type int(3.4) or MyClass(obj)
- implicit downcasting of objects
- numerous bug fixes and improvements

0.11-alpha (2009-feb-10)

- complete inheritance and polymorphism
- abstract, final and override function keywords
- support for non-class (run-once) script files
- modules and import statement
- typeof and var
- virtual thread system expanded beyond state code only
- idle functions can now be called anywhere
- idles/vthreads can also be used like asymmetrical coroutines

0.10-prealpha (2008-nov-16)

- Further merged the compiler and VM. Classes can now be created at
  runtime and through API calls.
- Four new types: uint, long, ulong and double
- Const array references: new array properties .const and .isConst
- 'const' modifier for function parameters (for arrays only)
- Array/string literals are now constants
- Improved memory performance for array literals
- Object cloning (obj.clone in Monster and mo.clone() in D/C++)
- Floating point reminder (%) and integer division (\) operators
- BOM markers are now recognized
- Ignore first lines beginning with #! (for unix scripts)
- Fixed incompatibility with DMD 1.032+
- Created 'tests' directory, reorganized examples
- Bug fixes and minor improvements

0.9-prealpha (2008-aug-27)

- Simple inheritance (no function overriding or polymorphism yet)
- Major rewrite: merged compiler and VM.
- Much more information at runtime: variable names/types, function
  parameters, etc.
- Read and write directly to class variables from native code.
- Compiler (mcc) and compiled files (.mc) are gone.
- Renamed file extension from .m to .mn to avoid editor conflict with
  Matlab scripts.
- Added generic type properties, like int.max, float.nan, etc. See
  examples/ for a list.
- Multiple script include directories - just do classes.addPath("dir").
- 'codetml' program for easy translation .mn -> html
- Lots of minor improvements.

0.8-prealpha (2008-apr-21)

- String concatination.
- Foreach on a class can loop through instances.
- Autogen programs now handle arrays correctly.
- Tango and C++ versions of the program 'mvm'.
- Better error handling in C++, exceptions can now "pass through"
  the interface (experimental.)
- Fixed the foreach ref bug and some other minor issues.
- Internal: cleanup and refactoring of compiler/scopes.d.

0.7-prealpha (2008-mar-12)

- Dynamic arrays. Syntax and semantics work pretty much like in D.
- Dynamic creation of single or multi-dimensional arrays.
- Array and string literals.
- Foreach loops, with type deduction, optional index and ref elements.
- Easy interface to pass arrays to and from native code (also for C++.)
- Array vararg function parameters.
- Break and continue in loops, with support for loop labels.
- Case insensitive string comparison operator: =i= and =I=.
- Changed syntax of empty state to "state = null;"
- Moved several mvm-based examples to examples/
- Implicit type conversions: int -> float, all types -> char[].
- Various small improvements and bugfixes.

0.6-prealpha (2008-feb-19)

- Added a Tango compatability layer ("minibos"). Monster now supports
  Tango "out of the box".
- Created dexamples-tango/ with Tango versions of all the examples.
- The VM will now compile script files automatically. You no longer
  need to run mcc.
- Removed hard coded function "writeln".
- Cleaned up shared/mcfile.d and finalized numbering in shared/bytecode.d
- Removed expensive consistency checks from util.list (add debug=slowcheck
  to bring them back.) This should improve performance of sdltest.

0.5-prealpha (2008-feb-07)

- dsss.conf for examples updated to work on windows
- resolved a circular module dependency issue on windows

0.4-prealpha (2008-jan-31)

- Labels, goto and halt statements can now be used in state code.
- Labels can be specified when changing state.
- States no longer loop automatically. Existing code must be updated.
- Improved dsss.conf files and restructured directories for better
  compatability with DSSS.
- Hugely simplified scope handling code in the compiler, and rewrote
  the entire type system.
- D version of 'sdltest' switched to DerelictSDL.
- All makefiles have been removed, except the ones that compile C++

0.3-prealpha (2007-dec-30)

- Made some workarounds to avoid DMD template bugs
- Full support for DSSS and Rebuild
- Should also work with GDC now (not extensively tested.)
- Example 'sdltest' can turn off graphics with the 'g' key
- C++ file monster.h is somewhat more const correct
- Compiler mcc prints file names to stdout

0.2-prealpha (2007-dec-20)

- C++ bindings.
- All examples are now implemented in both D and C++
- Binary (static library) download for C++ (no D compiler required)
- New utility programs (autogen_d, autogen_c) that automate
  creation of native code for D and C++
- Completely removed the redundant 'void' type from the language
- Compiler 'mcc' can compile multiple files at once (eg. 'mcc *.m')
- More examples, including an SDL example
- Restructured most of the vm code
- Can now bind functions (as well as delegates) to native functions
- Added util/freelist.d and util/growarray.d and several other files
- Multiple classes and object now fully implemented (but no inheritance yet)
- Lots of small improvements and bug fixes

0.1-prealpha (2007-sep-03)

- first release