next up previous
Next: the specific vocabulary of Up: Introduction Previous: Second order real differential

The programming language REC

The programming language REC was derived from LISP over a period of time, and found to be useful for minicomputers such as Digital Equipment's PDP-8, or early microprocessors such as the IMSAI or Polymorphic 88, given its extreme conciseness. That, in fact, is the reason why it is still preserved as an interface to programs written in other languages running with other operating systems.

REC itself is strictly a control structure, using parentheses to group sequences of instructions which are supposed to be executed in order -- in other words, programs. The instructions themselves, which are subdivided into operators and predicates, are not part of the control structure, but are always defined separately to create specialized variants on REC.

Besides the use of parentheses for aggrupation, the two punctuation marks, colon and semicolon, are used for repetition and termination, respectively; they were somewhat borrowed from musical notation. Spaces, tabs, all the C ``white space,'' are used for cosmetic purposes and must be ignored.

There is also a mechanism for defining subroutines; definitions and their associated symbols alternate between a balanced pair of curly brackets, terminating in a main program which remains nameless. Definitions so introduced are valid only within their braces, permitting symbols to be reused over and over again on different levels and in different places. A subroutine is actually executed by prefacing its name with an ``at sign,'' as in @x.

The distinction between operators and predicates is somewhat artificial, made mostly for convenience; a predicate which is always true is an operator. The values true and false of a predicate govern the sequence of operations, true meaning that the text of the program continues to be read in order, consecutively from left to right.

But false makes use of the punctuation, implying a skip to the next colon, semicolon, (or right parenthesis, in their absence) at the same parenthesis level. A colon means repetition starting back at the left parenthesis, a semicolon gives a true termination, realized by going forward to the closing right parenthesis, Arriving at a right parenthesis without the benefit of punctuation gives a false termination, but more generally inverts the action of predicates enclosed in such an interval.

This convention allows negating a predicate: (p) behaves oppositely from p. The other boolean combinations of predicates are easily written; ``p and q'' translates into (pq;), ``p or q'' into (p;q;). Moreover, all programs are predicates, even the main program, thereby reporting their results to the next higher program level, the one in which they occur as a subroutine.

next up previous
Next: the specific vocabulary of Up: Introduction Previous: Second order real differential