Difference between revisions of "The Script Programming Language"
Line 7: | Line 7: | ||
==<br /> Introduction == | ==<br /> Introduction == | ||
− | The Script adventure game language is an object-oriented language with a | + | 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. |
− | 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 | + | 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. |
− | characteristics, then go on to the object-oriented parts of the language. | ||
− | As is Lisp, Script is based on parenthesized expressions which return | + | As is Lisp, Script is based on parenthesized expressions which return values. An expression is of the form |
− | values. An expression is of the form | ||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
Line 21: | Line 17: | ||
(procedure [parameter parameter ...]).</syntaxhighlight> | (procedure [parameter parameter ...]).</syntaxhighlight> | ||
− | The parameters to a procedure may themselves be expressions to be | + | The parameters to a procedure may themselves be expressions to be evaluated, and may be nested until you lose track of the parentheses. |
− | 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 | + | Unlike Lisp, the procedure itself may NOT be the result of an evaluation. An example of an expression is |
− | example of an expression is | ||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
Line 45: | Line 39: | ||
will result in y = 2 and x = 4. | will result in y = 2 and x = 4. | ||
− | Comments in Script begin with a semi-colon, ';', and continue to the end of | + | Comments in Script begin with a semi-colon, ';', and continue to the end of the line. |
− | the line. | + | |
+ | |||
+ | === <br />Files === |
Revision as of 18:22, 28 November 2015
The Script Programming Language
Author: Jeff Stephenson
Date: 4 April 1988
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
(procedure [parameter parameter ...]).
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
(+ (- y 2) (/ x 3))
which would be written in infix notation as
(y - 2) + (x / 3).
All expressions are guaranteed to be evaluated from left to right. Thus,
(= x 4)
(= y (/ (+= x 4) (/= x 2)))
will result in y = 2 and x = 4.
Comments in Script begin with a semi-colon, ';', and continue to the end of the line.