Difference between revisions of "The Script Programming Language"

From SCI Wiki
Jump to navigationJump to search
 
(75 intermediate revisions by the same user not shown)
Line 1: Line 1:
The Script Programming Language
+
[[Official SCI Documentation]]<br />
  
Author: Jeff Stephenson<br />
+
<div align="center"><span style="font-size: 22pt">The Script Programming Language</span><br />
Date: 4 April 1988
+
''Author: [[Jeff Stephenson]]''<br />
 
+
Date: 4 April 1988</div>
 
 
==<br /> Introduction ==
 
 
 
The Script adventure game language is an object-oriented language with a Lisp-like syntax. It is compiled by the sc compiler into the pseudo-code which is used by the interpreter, sci.
 
 
 
We will begin our discussion of the language with its basic Lisp-like characteristics, then go on to the object-oriented parts of the language.
 
 
 
As is Lisp, Script is based on parenthesized expressions which return values. An expression is of the form
 
 
 
<blockquote>
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="sci">
 
(procedure [parameter parameter ...]).
 
</syntaxhighlight>
 
</blockquote>
 
 
 
The parameters to a procedure may themselves be expressions to be evaluated, and may be nested until you lose track of the parentheses.
 
 
 
Unlike Lisp, the procedure itself may NOT be the result of an evaluation. An example of an expression is
 
 
 
<blockquote>
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="sci">
 
(+ (- y 2) (/ x 3))
 
</syntaxhighlight>
 
</blockquote>
 
 
 
which would be written in infix notation as
 
 
 
<blockquote>
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="sci">
 
      (y - 2) + (x / 3).
 
</syntaxhighlight>
 
</blockquote>
 
 
 
All expressions are guaranteed to be evaluated from left to right. Thus,
 
  
 
<blockquote>
 
<blockquote>
<div class="CodeBlockHeader">Code:</div>
+
*[[The Script Programming Language/Introduction | Introduction]]
<syntaxhighlight lang="sci">
+
*[[The Script Programming Language/Files | Files]]
(= x 4)
+
*[[The Script Programming Language/Definitions | Definitions]]
(= y (/ (+= x 4) (/= x 2)))
+
*[[The Script Programming Language/Data Types and Variables | Data Types and Variables]]
</syntaxhighlight>
+
*[[The Script Programming Language/Primitive Procedures | Primitive Procedures]]
 +
**[[The Script Programming Language/Primitive Procedures#Arithmetic primitives | Arithmetic primitives]]
 +
**[[The Script Programming Language/Primitive Procedures#Boolean primitives | Boolean primitives]]
 +
**[[The Script Programming Language/Primitive Procedures#Assignment primitives | Assignment primitives]]
 +
*[[The Script Programming Language/Control Flow | Control Flow]]
 +
**[[The Script Programming Language/Control Flow#Conditionals | Conditionals]]
 +
**[[The Script Programming Language/Control Flow#Iteration | Iteration]]
 +
*[[The Script Programming Language/Procedures | Procedures]]
 +
*[[The Script Programming Language/Using SC | Using SC]]
 +
*[[The Script Programming Language/Index | Index]]
 
</blockquote>
 
</blockquote>
  
will result in y = 2 and x = 4.
+
<div align="center">
 +
Chapter:
 +
[[The Script Programming Language/Introduction|1]] |
 +
[[The Script Programming Language/Files|2]] |
 +
[[The Script Programming Language/Definitions|3]] |
 +
[[The Script Programming Language/Data Types and Variables|4]] |
 +
[[The Script Programming Language/Primitive Procedures|5]] |
 +
[[The Script Programming Language/Control Flow|6]] |
 +
[[The Script Programming Language/Procedures|7]] |
 +
[[The Script Programming Language/Using SC|8]] |
 +
[[The Script Programming Language/Index|Index]]
 +
</div><br />
  
Comments in Script begin with a semi-colon, ';', and continue to the end of the line.
+
* [[Media:SCRIPT.pdf|Download The Script Programming Language in PDF Form]]<br />
  
  
=== <br />Files ===
+
&nbsp;
  
Source files for the script compiler have the extension .sc, header (include) files have the extension .sh. Source files may have any filename -- banner.sc and castle.sc are two examples. The output file from the compilation will have the name script.nnn where nnn is determined from the script# command (covered below) which is present in the file.
+
<span style="float: left"><span class="Inactive">&lt; Previous: </span></span><span style="float: right">[[The Script Programming Language/Introduction|Next: Introduction &gt;]]</span>
  
There are six files besides the source file and any user-defined header files which are involved in a compilation.
+
&nbsp;
  
<blockquote>classdef</blockquote>
+
[[Category:SCI Documentation]]
This file contains the information about the structure of the classes which have been defined in the application. It is read automatically by the compiler and is rewritten by the compiler after a successful compilation in order to keep it up to date. The user need not be concerned with it.
+
[[Category:Scripting]]

Latest revision as of 20:12, 2 December 2015