The Dialog compiler

Dialog is a compiled language. Source code is stored in text files with the filename extension .dg. When international characters are used, they must be encoded in UTF-8. The compiler delivers its output in .z8 or .zblorb format. When the zblorb format is chosen, the compiler can optionally include cover art with the story, but this feature is not regarded as a part of the Dialog language itself.

An archive containing the latest version of Dialog can be found here:

https://linusakesson.net/dialog/

The archive contains the full source code for the Dialog compiler, as well as pre-built executable files for Linux (i386 and x86_64) and Windows.

To build the compiler from source, you need a working C compiler (such as gcc or clang) and some version of the make command (such as gmake). Unpack the archive, enter the src directory, and type “make”. If all went well, you should now have an executable file called dialogc in the current directory. This is the Dialog compiler.

If you are on a Unix-like system, and you wish to install the compiler in a system-wide location, type “sudo make install”.

The archive also contains the latest version of the Dialog standard library, stdlib.dg, and the standard debugging library extension, stddebug.dg. You should make local copies of these files for each of your projects, because if you ever wish to rebuild your story in the future, you'll want to have access to the exact version of the library you used. Also, you may wish to make story-specific modifications to the library.

A copy of this manual is also included in the archive, and a file called license.txt that details how you may use the software. This is a standard 2-clause BSD license, granting you the right to use, modify, and redistribute the compiler and standard library (with or without source code), in whole or in part, as long as attribution is given.

If you've successfully built and installed the Dialog compiler, you should be able to go to a commandline shell and type:

dialogc --version

This will print the version number of the compiler. The first two characters (a digit and a letter) identify the language version, which is currently 0b. Following that is a slash, and then the compiler revision number.

To compile a Dialog story into zblorb format, invoke the compiler with the source code filenames as arguments, and optionally use -o to specify an output filename. The default output filename is constructed from the name of the first source code file, combined with a filename extension that is appropriate for the current output format.

The order of source code filenames is important. The story must appear before the standard library, and any extensions (such as the standard debugging library) should appear in between. For instance:

dialogc story.dg stddebug.dg stdlib.dg

This will produce a file called story.zblorb, based on the name of the first source code file.

The example games in this manual do not declare IFIDs, which is mandatory when the zblorb output format is used. To compile the examples, you must ask the compiler to emit raw z8 code by adding -t z8 to the command line:

dialogc -t z8 example.dg stdlib.dg

This will produce a file called example.z8.

The examples in Part I do not make use of the standard library at all, so they are compiled like this:

dialogc -t z8 example.dg

The -v flag makes the compiler more verbose. Give it once, and the compiler will print the wordcount for your story, as well as some technical stats. Give it twice (-vv) and the compiler will dump additional information that can be useful for debugging.

To see the full list of options supported by dialogc, type:

dialogc --help