From eff22fa20409330cf1a3c3d2c743cafa75b5b72a Mon Sep 17 00:00:00 2001 From: Jason Self Date: Thu, 30 Jul 2015 13:06:55 -0700 Subject: [PATCH] Adding more information --- documentation/zil.md | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/documentation/zil.md b/documentation/zil.md index c2caf8f..4d30b87 100644 --- a/documentation/zil.md +++ b/documentation/zil.md @@ -1,6 +1,9 @@ -# Zork Implentation Language -This document covers the Zork Implementation Language, as originally -developed and used by Infocom for their games. +# Introduction +This document covers the Zork Implementation Language, or ZIL for +short, as originally developed and used by Infocom for their games. + +ZIL is a subset of the MIT Design Language, or MDL for short, and +pronounced as "Muddle". MDL is itself based on classic LISP. ## Format This document is written using CommonMark, a markup language. More @@ -17,7 +20,6 @@ License along with this document. If not see . ## Definitions - A "definition" is used to describe a room, object, routine, etc. in or used by the game. Each definition consists of a number of properties, flags, and/or instructions. A program written in ZIL can be thought of @@ -25,9 +27,39 @@ as consisting of one or more of these definitions. Definitions, properties, flags, and instructions include brackets which must be correctly paired and nested. +## Comments +Comments are ignored by the compiler. A comment begins with a +semicolon (;) and continues until the end of the line. A multiline +comment also begins with a semicolon but is enclosed in double +quotes. However, single line comments may also be enclosed in double +quotes. While comments may be placed anywhere in a source code file, a +comment may not be placed inside an atom. + +## Parser +The purpose of the parser is to receive and process the player's +input. Its primary responsibility is to determine the player's +intended action along with any objects that may be referred to. + +The player's action is referred to internally as the PRSA (think "A" +for action like "EAT", the direct object as PRSO (think "O" for +"object") and the indirect object as PRSI (think "I" for indirect.) + +For an example, the command "KILL TROLL WITH SWORD" would set the PRSA +to KILL and the PRSO to TROLL and PRSI to SWORD. It is important to +note that not all instructions from the player will necessarily have +all three things, but a PRSA is required in all cases and you can't +have a PRSI without also having a PRSO. In cases where there is no +PRSI or PRSO, they are set to false. + +Note that the PRSA isn't simply the word that the player entered. The +PRSA from a given sentence is determined by the syntax definitions in +the game. An example being: The player might type "CONSUME APPLE" but +in the game's syntax definitions, the PRSA associated with "consume" +might be EAT. + ## Syntax Definitions Syntax definitions are used by the parser to determine valid sentence -structures. +structures. Each entry must correspond to this format: A simple example might be: @@ -36,3 +68,5 @@ A simple example might be: Using this example, should the parser match the player's input to "xyzzy" then the PRSA is set to magic. PRSI and PRSO would be set to false. + +## Syntax Tokens -- 2.31.1