Inform 6.36

A new release of Inform 6, version 6.36, is now available from the Inform 6 Github project, and from the IF-Archive: Release notes, source code and Windows console executable.

Features added

  • The algorithm used to apply abbreviations for Z-code has been replaced with a more efficient dynamic programming algorithm, based on the paper by R.A. Wagner “Common phrases and minimum-space text storage”, Communications of the ACM, 16 (3) (1973).

  • Inform has been refactored to use dynamic memory allocation rather than fixed size buffers. As a result, the following settings are now removed: if the available space is filled, Inform will allocate more memory without requiring user intervention.

    • ALLOC_CHUNK_SIZE
    • SYMBOLS_CHUNK_SIZE
    • MAX_ABBREVS (removed only for Glulx)
    • MAX_ACTIONS
    • MAX_ADJECTIVES
    • MAX_ARRAYS
    • MAX_CLASSES
    • MAX_DICT_ENTRIES
    • MAX_EXPRESSION_NODES
    • MAX_GLOBAL_VARIABLES
    • MAX_INCLUSION_DEPTH
    • MAX_INDIV_PROP_TABLE_SIZE
    • MAX_LABELS
    • MAX_LINESPACE
    • MAX_LINK_DATA_SIZE
    • MAX_LOCAL_VARIABLES (now a constant)
    • MAX_LOW_STRINGS
    • MAX_NUM_STATIC_STRINGS
    • MAX_OBJ_PROP_COUNT
    • MAX_OBJ_PROP_TABLE_SIZE
    • MAX_OBJECTS
    • MAX_PROP_TABLE_SIZE
    • MAX_QTEXT_SIZE
    • MAX_SOURCE_FILES
    • MAX_STATIC_DATA
    • MAX_STATIC_STRINGS
    • MAX_SYMBOLS
    • MAX_TRANSCRIPT_SIZE
    • MAX_UNICODE_CHARS
    • MAX_VERBS
    • MAX_VERBSPACE
    • MAX_ZCODE_SIZE

    As a result of this, the memory size command line arguments ($SMALL, $LARGE and $HUGE) are now redundant, and have been removed.

  • It is now possible to declare an individual property with the Property directive:

    Property individual propname;
    
  • A new setting $ZCODE_LESS_DICT_DATA has been introduced. When set to a non-zero value, this tells the compiler to omit the last byte of Z-code dictionary entries (which can be referred as #dict_par3), as this is commonly unused.

  • There are now warnings if the compiler detects that the type used in certain expressions is not correct. This only checks expressions that contain defined symbols, and does not change the generated code. The checks are:

    • remove O: O is an object
    • move O to P: O is an object; P is an object or a class
    • give O A: O is an object; A is an attribute
    • O has/hasnt A: O is an object; A is an attribute
    • O in/notin P: O is an object; P is an object or a class
    • X ofclass C: C is a class
    • X provides P: P is a property
    • X.P, X.P(), X.&P, X.#P: P is a property
  • Assembly output (-a mode) now shows symbolic information for each assembly operand, if possible.

  • The -u switch now generates $MAX_ABBREVS possible abbreviations.

  • The Trace verbs directive now prints out the entire grammar table.

  • Using the -D switch when the game or library does not support debug_flag now produces an explanatory warning:

    DEBUG mode is on, but this story or library does not appear to support it
    
  • Expressions of the form (x <= y or z) or (x >= y or z) now produce a warning message: while their effect is documented, well defined, and is not being changed, it is not necessarily what a user might expect.

  • The check for whether an abbreviation actually reduces the size of the Z-code output file has been made more accurate, and the message if an abbreviation does not reduce the size is now a warning, rather than an error.

Bugs fixed

  • For Glulx, stub functions (and the veneer function Symb__Tab()) are now always compiled as local-argument functions (with a type byte of 0xC1). Previously, they were in some cases compiled as stack-argument functions (with a type byte of 0xC0).

  • Counts of properties in errors and in the statistics report (output with the -s switch) are now consistent, and reflect how many properties the user can define.

  • The check that there are not too many common properties defined now correctly excludes individual and alias properties.

  • Inform will now report an error if the “class” line of a class definition mentions the class being defined.

  • A crash when compiling a malformed array declaration has been fixed.

18 Likes

What is the constant value for MAX_LOCAL_VARIABLES?

1 Like

It’s 15 for Z-code. With everything else in Glulx being 32-bit, I can just guess that it’s 4 billion.

Actually it’s 16 and 119. But one of those is the stack pointer.

1 Like

The limit of 119 in Glulx is due to a limit in Inform’s low-level parser. (The definition of struct keyword_group, if you’re curious.)

For Z-code, of course, it is a Z-machine limit.

2 Likes

Woot, this is fantastic news. Thanks, David, and thanks, Andrew, for the dynamic memory allocation, and @mulehollandaise for the abbreviation implementation.

I’ve been thinking about schemes for optimizing text storage space by identifying common substrings and had been failing to find the right search terms to turn up the prior art I felt sure must exist, so I appreciate the pointer to the paper! Guess I should’ve been following Highly optimized abbreviations computed efficiently.

3 Likes

Compiles perfectly, no warnings nor errors, but seems to generate bigger files:

test/inf636$ ls -l dekam.z5 ../../dekam/dekam.z5
-rw-r--r-- 1 pigi pigi 92160 27 gen 13.50 ../../dekam/dekam.z5
-rw-r--r-- 1 pigi pigi 90624 27 gen 13.46 dekam.z5

the first compiled with inform 6.36, the second with inform 6.35 release 8, and the current standard lib, 6.12.5 with -S

the -s output of inform 6.36:

Inform 6.36 for Linux (24th January 2022)
In:  7 source code files             10790 syntactic lines
 12999 textual lines                443626 characters (ISO 8859-1 Latin1)
Allocated:
  1394 symbols                      775918 bytes of memory
Out:   Version 5 "Advanced" story file 1.220127 (88.5K long):
     6 classes                          44 objects
   161 global vars (maximum 233)      2480 variable/array space
    97 verbs                           352 dictionary entries
   201 grammar lines (version 2)       330 grammar tokens (unlimited)
   113 actions                          31 attributes (maximum 48)
    48 common props (maximum 61)        50 individual props (unlimited)
 20467 characters used in text       16288 bytes compressed (rate 0.795)
     0 abbreviations (maximum 64)      416 routines (unlimited)
 15247 instructions of Z-code         6271 sequence points
 11232 bytes readable memory used (maximum 65536)
 90556 bytes used in Z-machine      171588 bytes free in Z-machine
Completed in 0.019 seconds

and that of 6.35r8:

Inform 6.35 for Unix (22nd May 2021)
In:  7 source code files             10872 syntactic lines
 13108 textual lines                447450 characters (ISO 8859-1 Latin1)
Allocated:
  1398 symbols (maximum 10000)     1056522 bytes of memory
Out:   Version 5 "Advanced" story file 1.220127 (90K long):
     6 classes (maximum  64)            44 objects (maximum 639)
   161 global vars (maximum 233)      2480 variable/array space (maximum 10000)
    99 verbs (maximum 200)             352 dictionary entries (maximum 2000)
   207 grammar lines (version 2)       342 grammar tokens (unlimited)
   113 actions (maximum 200)            31 attributes (maximum 48)
    49 common props (maximum 62)        50 individual props (unlimited)
 20559 characters used in text       16362 bytes compressed (rate 0.795)
     0 abbreviations (maximum 64)      417 routines (unlimited)
 15509 instructions of Z-code         6334 sequence points
 11292 bytes readable memory used (maximum 65536)
 91844 bytes used in Z-machine      170300 bytes free in Z-machine
Completed in 0 seconds

seems somethig worth investigating, or not ?

Best regards from Italy,
dott. Piergiorgio.

According to your output it’s the 6.36 that is the smaller one, or am I wrong?

Inform 6.35 for Unix (22nd May 2021)
...
91844 bytes used in Z-machine
...
Inform 6.36 for Linux (24th January 2022)
...
90556 bytes used in Z-machine
...

There is also other things that differ beween the compilations. Are they compiled from the same source with the same library?

I6 6.35 and 6.36 should compile exactly the same game files for Z-code, except for the header field that says “Compiled by Inform 6.35/6.36”.

For Glulx, the compiled game files differ slightly (see this bug, fixed in 6.36). But the result should be the same size or, perhaps, slightly shorter.

indeed… seems that I have done a little mess in reading and copypasting from different dirs:

with a common dir the results are indeed equal between the two informs with the standard library 6.12.5:

totale 464
-rw-r--r-- 1 pigi pigi 92160 29 gen 10.55 dekam635.z5
-rw-r--r-- 1 pigi pigi 92160 29 gen 11.03 dekam636.z5
-rw-r--r-- 1 pigi pigi 87040 29 gen 10.53 shell635.z5
-rw-r--r-- 1 pigi pigi 87040 29 gen 11.04 shell636.z5
-rw-r--r-- 1 pigi pigi 86016 29 gen 10.51 shell.z5
-rw-r--r-- 1 pigi pigi 10793 21 mar  2020 dekam.inf
-rw-r--r-- 1 pigi pigi   618 10 lug  2008 shell.inf

sorry for the false alarm :flushed: and
Best regards from Italy,
dott. Piergiorgio.

I know that there was some discussion not so very long ago about the best options to use when compiling, but I can’t seem to find it now. The basic compilation command of

cc *.c -o inform

works fine, but weren’t some switches for optimization recommended?

If there were, these switches do not seem to be mentioned in either the current release notes or the readme.txt file included with source. Would it be possible to add the correct invocation to one or both documents?

It is described in the README.md:

https://github.com/DavidKinder/Inform6/blob/master/README.md

cc -O2 -o inform *.c

You also want to use the appropriate OS define:

cc -DMACOS -O2 -o inform *.c
cc -DLINUX -O2 -o inform *.c

The OS define doesn’t change the compilation speed. The main thing it gets you is high-precision time measurement. When you use the -s option, the compiler will tell you:

Completed in 0.060 seconds

With no OS define, it defaults to measuring seconds, so it will print:

Completed in 0.000 seconds

(Which is misleadingly precise, I know, sorry.)

2 Likes

Ah, OK. Thank you, zarf.

Is that file supposed to be included in the source code download that’s at the IF Archive? At present, the included readme.txt file only says:

This is version 6.36 of the Inform compiler,
copyright (c) Graham Nelson 1993 - 2022
Full release notes and instructions are available at
http://www.ifarchive.org/indexes/if-archiveXinfocomXcompilersXinform6.html

and the release notes at that URL (which could probably be switched to https since it looks like that’s supported now) doesn’t mention the README.md file or its URL.

Hm, yes, I see. I guess that readme.txt was written with the assumption that any important information would be in the release notes (at that Archive URL). But the compilation info isn’t.

I’ll file a note.

1 Like

Just a note:
Compiling Inform 6.36 on a Raspberry Pi 4 works fine using:

cc -O2 -o inform *.c

I was then able to compile Jamjar a WIP using 6.36 and Punyinform 3.5.

2 Likes