Inform 7 v10's Compile to C question

Even without the Parser/World Model, there’s a lot of stuff built into Basic Inform: you have all the infrastructure for relations, tables, rules, rulebooks, activities, and generating adaptive text. For instance, you could write this:

Datum is a kind of object.
The plural of datum is data.

Surveys is a plural-named datum.
Graph is a datum.

To demonstrate is a verb.

To begin:
  say "[The surveys] [demonstrate].";
  now the story tense is future tense;
  say "[The graph] [demonstrate]."

And there’s no attempt to strip unused functions. And the way that Inter is translated into C seems to work a lot like: imagine what glulx bytecode the I6 compiler would generate for this bit of Inter, and then generate C that imitates each of those bytecodes in turn.

With gcc, the program above compiled to a 985K binary, but letting gcc optimize for size and strip unused stuff, it got down to 384K.

gcc -lm -I"inform7/Tangled"  -Os -flto -fdata-sections -ffunction-sections basic.c -o basic  -Wl,--gc-sections
2 Likes