Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reform 6

The repository is Reform 6, a separate project built on top of Inform 6. More details will be coming soon as to why this exists. The pre-existing Inform 6 project documentation is retained below.

What Is This?

Inform 6 has always felt like a language that sits somewhere between Pascal and C. Leaning into the C syntax without abandoning the language's identity seems like a reasonable evolution. So, that's what this project does.

This project is an experiment in modernizing and extending Inform 6's syntax, purely as a language-design exploration. Every change here is additive: existing Inform 6 source, including the standard library, compiles and runs completely unmodified. Nothing will be removed or made incompatible; both the old and new forms can be freely mixed in the same program.

Library integration

Unlike the Inform 6 project, where the compiler and library live in separate repositories, this project bundles both together, since it doesn't anticipate changes flowing back and forth. A single clone gets you a working compiler and a working library.

New comment styles

In addition to the traditional ! end-of-line comment, both of the familiar C/C++ forms are now supported:

! traditional Inform 6 comment
// C-style end-of-line comment
/* C-style block comment, which can
   span multiple lines */

Block comments do not nest (matching C/C++): the first */ found closes the comment, even if it contains what looks like another /*.

C-style function definitions

Alongside the traditional bracket syntax:

[ CubeIt x;
   return x * x * x;
];

routines can now also be written C-style, with a parenthesized parameter list and brace-delimited body:

CubeIt(x) {
   return x * x * x;
}

Both forms compile to byte-identical code. Anonymous routines used as object/class property values (e.g. before [ ; ... ]) still use bracket syntax, since there's no name to attach the new form to.

C-style Reform library

A reform6lib exists in this repo and this is a converted version of inform6lib (the standard library), to use the C-style syntax. This was done to prove that a story file could be compiled with the library itself fully converted and still produced identical binary output.

Either spelling of the game's setup hook

The standard library requires every game to define an Initialise() routine, called once as part of startup. This is a library convention, not a compiler one. The compiler has no idea Initialise exists at all, it only requires a routine called Main (see library/grammar.h). reform6lib/ (the Reform6 library) additionally accepts the American spelling, Initialize(), as an equivalent. Define whichever one you prefer, and the library calls it correctly either way.

This only works with reform6lib/, not inform6lib/, since it's a Reform6 addition to the library itself, not a compiler feature. It's also not a simple #Ifdef check: Inform compiles top-to-bottom in a single pass, and a game's Initialise/Initialize definition normally comes after Include "parser" (where the library's call to it lives), so a check placed there would never see it. The check has to live at the end of the standard Parser/VerbLib/[game]/Grammar include order instead; specifically, in Grammar.h, after the game's own routines have already been compiled, where it defines whichever spelling is missing as a one-line forward to the other.

Compiler phase inspection

Three switches let you look inside the compiler as it works, rather than just getting a finished story file:

inform -t story.inf     ! trace tokens as the lexer produces them
inform -p story.inf     ! trace the parse tree built for each expression
inform -a story.inf     ! trace the assembled Z-code/Glulx instructions

Each takes an optional digit for more or less verbosity (-t1/-t2/-t3, -p1/-p2/-p3, -a1 through -a4) -- see inform -h2. Add -n to any of them to suppress the story file entirely, so you can inspect a single phase's output without producing (or caring about) a finished game, e.g. inform -tn story.inf.

It's worth being upfront about what these switches can and can't show, since it comes down to how this compiler is actually built. Inform 6 is a single-pass, syntax-directed-translation compiler: parsing and code generation are fused, and lexing itself is context-sensitive (the parser toggles what the lexer recognizes as it goes), so there's no independent "tokens" pass and no persisted whole-program AST to dump. -t and -a are honest matches for "tokens" and "IR"; in fact, -a in particular already shows the lowest-level representation this compiler ever produces, since Z-code/Glulx instructions are the terminal form. -p, though, only ever shows the parse tree built for one expression at a time (a real expression_tree_node tree, in expressp.c): statements, routines, and objects are turned directly into code with no tree of their own, so there's no single whole-program "AST" for -p to show.

License

Inform 6 is dual-licensed (see licence.txt): the original Inform License, or the Artistic License 2.0, at the user's choice. Reform 6 is distributed as a Modified Version under the Artistic License 2.0.

That license's terms are why this project is named and built the way it is:

  • Clause 4(b) requires that a distributed Modified Version "bear a name that is different from the name of the Standard Version" — hence Reform 6, and the compiled reform6.exe/reform6 rather than inform6.exe/inform6.
  • Clause 12 does not grant rights to the Copyright Holder's trademark or tradename, which reinforces not shipping this under the Inform name.
  • Clauses 2-4 require that the original copyright notices be retained in full (see licence.txt and the header comments throughout the source) and that differences from the Standard Version be clearly documented, which this README section (and future ones) is intended to do.

Reform 6 remains built on, and credited to, Inform 6, copyright (c) Graham Nelson 1993 - 2025.

Building on Windows

The Windows build compiles all of the .c files in the repository root via visual_studio\inform6.vcxproj, using the PC_WIN32 preprocessor define. Whichever way you build, the executable ends up at:

  bin\Win32\Release\reform6.exe
  bin\Win32\Debug\reform6.exe

Debug builds keep their intermediate object files and .pdb under bin\Win32\Debug\obj\, alongside the executable. Release builds produce nothing but the .exe: intermediates are written to bin\obj\Win32\Release\ during the build and deleted automatically once linking succeeds.

Visual Studio Code

Requires the C/C++ extension and a Visual Studio 2022 installation (Build Tools or full IDE) with the "Desktop development with C++" workload. .vscode/tasks.json, launch.json, and c_cpp_properties.json are committed to the repo, so this works right after cloning — no setup beyond installing the extension and VS.

  • Ctrl+Shift+B builds the Release configuration by default. A separate "Build reform6 (MSBuild, Debug x86)" task is also available from the task picker.
  • F5 builds the Debug configuration and launches reform6.exe under the debugger against tests\minimal_test.inf.

The build task locates MSBuild.exe via scripts\build.ps1, which uses vswhere.exe (installed by the VS Installer at a fixed, version-independent path) rather than a hardcoded path — so it works regardless of VS edition or exact toolset version. IntelliSense's compiler path is left unset for the same reason: the C/C++ extension auto-detects installed MSVC toolsets on its own; if prompted, pick the one matching this workspace.

Visual Studio IDE

Open visual_studio\inform6.vcxproj directly, pick a Configuration (Debug/Release) and Platform (Win32/x64), and build as usual (F7 or Ctrl+Shift+B).

Command line

  MSBuild.exe visual_studio\inform6.vcxproj /property:Configuration=Release /property:Platform=x86

(This is also what CI runs — see .github/workflows/windows_build.yml.)

Inform 6

This is Inform 6.44, copyright (c) Graham Nelson 1993 - 2025, a compiler for interactive fiction (text adventure games).

Release notes, manuals, executables and more are available from https://ifarchive.org/indexes/if-archive/infocom/compilers/inform6/.

Introduction

Back in the late 1980s, people began investigating the format of Infocom's text adventures. Infocom used a standard format that defined a virtual machine, which has come to be known as the Z-Machine, to allow them to be able to port their games to many different computers. This investigation lead to the creation of open source implementations of the Z-Machine, such as the InfoTaskForce interpreter, Zip, Frotz, and many others.

In 1993, Graham Nelson released the first version of Inform, which compiled a somewhat C-like language ("Inform") to the Z-Machine. In the years that followed this led to the creation of hundreds of free games by a community that had sprung up based around the Usenet group rec.arts.int-fiction.

The latest version of Inform is Inform 7, but Inform 6 still lives on, both as the code generator used by Inform 7, and as a language and compiler in its own right. Inform 6 is now considered stable and only has bugs fixed and minor, non-breaking features added, but development continues.

Using Inform 6

To use the compiler, you will need an executable. There are pre-built executables available, or you can compile the source yourself. All that is required is a C compiler and for it to be invoked with something like

  cc -O2 -o inform *.c

Suitable defaults for various operating systems can be selected by defining the appropriate symbol, a list of which are near the top of the "header.h" file (under "Our host machine or OS for today is..."). For example, to compile for Windows, use

  cc -DPC_WIN32 -O2 -o inform *.c

To write a work of interactive fiction with Inform 6, you will also need a version of the Inform 6 library. Stable versions of the library are available, and development of the library continues in a separate project.

More resources and documentation, including the Inform Designer's Manual, are available from the Inform 6 web site.

About

An Extended Version of Inform 6

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages