IncursionScript & the Accent compiler compiler
When I started working with the Incursion source code, which Julian released, one of the problems was that not all the source code was available. The bulk of the game data, both for d20 elements and dungeon generation, is specified in scripts. These "IncursionScript" files are compiled into a module, which Incursion can have more than one of.
The problem was that they are compiled using the Accent compiler compiler. And Julian had a version of this, which had been custom modified to produce C++ compatible code, but no longer had the source code. I downloaded the original Accent source code and proceeded to try and get it working.
The Accent tool takes a ".acc" file, and transforms it into ".c" and ".h" files which you can compile against. But it is also generated source code, created using some tool called Gentile. The correct way to do this, which it appears Julian also avoided, would be to modify the Gentile grammar for Accent, and to generate a new version. Instead, the approach we both took was to modify the generated Accent source code.
Accent is old school C code. Seldom having return types in it's own source code, and rarely producing return types in the code it generates. Occasionally using uninitialised stack variables, and expecting the value to be NULL. And it generated argument typing for function declarations the other way, where rather than including the type with the argument name in the parenthesised list following the function name, the variable is redeclared fully (in the same way as stack variables) following that list and preceding the function body.
function(argname1, argname2, argname3) int argname1; char *argname2; void *argname3; {
It is really the fixing of these three things that makes Accent C++ compatible, rather than making it output C++ specific elements. In any case, a modified version of the Accent source code is now checked into the Incursion repository. This is built as a dependency of the main Incursion project, ensuring that if there are any grammar changes, then they are rebuilt as needed.
No comments:
Post a Comment