Add Compiler
[inform-resources.git] / informqr / informqr.md
index 490805c78ad3b363cad486536ac0a46135c637e5..ea91c72a2e90366a0d5387b6190af5a23f3b85a8 100644 (file)
@@ -348,7 +348,7 @@ A routine **embedded** as the value of an object property:
             statement;
             ]
 
-Routines return a single value, when execution reaches the final "\]"
+Routines return a single value, when execution reaches the final "]"
 or an explicit return statement:
 
     return expr;
@@ -577,4 +577,127 @@ optional, depending on the action):
 To explicitly trigger a defined action, then return `true` from the
 current routine:
 
-    <<action noun second >>;
\ No newline at end of file
+    <<action noun second >>;
+
+Other useful directives
+-----------------------
+
+To include a directive within a routine definition [...], insert a
+hash "#" as its first character.
+
+To conditionally compile:
+
+    Ifdef name;   ! use any one of these
+    Ifndef name;  !
+    Iftrue expr;  !
+    Iffalse expr; !
+    ...
+    Ifnot;
+    ...
+    Endif;
+
+To display a compile-time message:
+
+    Message "string";
+
+To include the contents of a file, searching the Library path:
+
+    Include "source_file";
+
+To include the contents of a file in the same location as the current
+file:
+
+    Include ">source_file";
+
+To specify that a library routine is to be replaced:
+
+    Replace routine;
+
+To set the game's release number (default is 1), serial number
+(default is today's *yymmdd*) and status line format (default is
+`score`):
+
+    Release expr;
+    Serial "yymmdd";
+    Statusline score;
+    Statusline time;
+
+To declare a new attribute common to all objects:
+
+    Attribute attribute ;
+
+To declare a new property common to all objects:
+
+    Property property;
+    Property property expr;
+
+Uncommon and deprecated directives
+----------------------------------
+
+You're unlikely to need these; look them up if necessary.
+
+    Abbreviate "string " "string " ... "string ";
+    End;
+    Import variable variable ... variable;
+    Link "compiled_file";
+    Switches list_of_compiler_switches;
+    System_file;
+
+File structure
+--------------
+
+A minimal source file:
+
+    Constant Story "MYGAME";
+    Constant Headline "^My first Inform game.^";
+    Constant MANUAL_PRONOUNS;
+
+    Include "Parser";
+    Include "VerbLib";
+
+    [ Initialise; location = study; "^Hello!^"; ];
+
+    Class  Room
+     with  description "A bare room."
+      has  light;
+
+    Class  Furniture
+     with  before [; Take,Pull,Push,Pushdir:
+               print_ret (The) self,
+                   " is too heavy for that."; ]
+      has  static supporter;
+
+    Room   study "Your study';
+
+    Furniture "writing desk" study
+     with  name 'writing' 'desk' 'table';
+
+    Object  -> -> axe "rusty axe"
+      with  name 'rusty' 'blunt' 'axe' 'hatchet'
+            description "It seems old and blunt.";
+
+    Include "Grammar";
+
+Compiler
+--------
+
+To compile:
+
+    inform commands source_file
+
+Useful *commands* include:
+
+  -------------- ------------------------------------------------
+  -~S            disable both Strict checks and Debug tools
+  -~SD           disable Strict checks, enable Debug tools
+  -X             enable Infix debugger
+  -r             output all game text to file (for spell-check)
+  -s             display game's size and other statistics
+  -z             display game's memory map
+  -v8            compile in Version 8 format (default is v5)
+  +dir,dir,...   search for Included files in these directories
+  -------------- ------------------------------------------------
+
+To display full compiler help, type:
+
+    inform -h -h1 -h2
\ No newline at end of file