Jump to content

CAL (programming language)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Maury Markowitz (talk | contribs) at 11:13, 17 October 2019 (working...). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

CAL (Conversational Algebraic Language) was a programming language and system designed and developed by Butler Lampson at Berkeley in 1967. CAL is a version of the seminal [[JOSS] language with a number of cleanups and new features to take advantage of the SDS 940.

The Berkeley SDS was used for the development of the Tymshare commercial time-sharing platform, and CAL was offered as a programming environment to its customers. CAL saw "almost no use" in this market, but had a lasting impact by influencing the development of Tymshare SUPER BASIC which copied a number of its features. Those features, in turn, appeared in BASIC-PLUS on the PDP-11, which is the direct ancestor of Microsoft BASIC.[1]

Description

JOSS had been designed to be used by non-programmers in the US Air Force, and to aid with that, Rand Corporation designed custom computer terminals that were easier to set up and use. These terminals also included a custom character set that implemented common mathematical symbols like and .

To a large degree, CAL was a version of JOSS that replaced these sorts of customizations with more common solutions like {{{1}}} and #. The other noticeable difference was that CAL was all upper-case and did not require a period at the end of the line. The commands were otherwise almost identical and the overall structure and syntax the same. Had communications between the systems been possible, porting from JOSS to CAL would be simple.

One of the more notable stylistic features of JOSS was the concept of "statement modifiers" which controlled the operation of other statements. In most languages, one would write something to the effect of "if this expression is true, then do this...". In JOSS, this order was reversed, and such statements took the form {{{1}}}. CAL added some syntactic sugar to this basic concept by adding the new modifier UNLESS, which, depending on context, led to more obvious code, {{{1}}}.[2]

CAL further modified the basic if statement by adding THEN and ELSE. In JOSS, if one wanted to assign the value 5 to a variable A if the value of B was larger that 10, and 0 otherwise, the code would be:

Set A=5 if B>10.
Set A=0 if B<=10.

This sort of either/or assignment is very common in many cases. CAL improved this by implementing a nElvis operator:[3]

A=IF B>10 THEN 5 ELSE 0

Looping in JOSS was also controlled by a modifier, the For. This used somewhat confusing syntax, {{{1}}} runs a loop from 1 to 10 stepping by 2, so it would print 1,3,5,7,9. CAL cleaned this up with the BY and TO keywords, so the equivalent code in CAL would be {{{1}}}. As in JOSS, the range of the for could be defined using BY and TO, an explicit list of numbers, {{{1}}}, or a mixture of both, {{{1}}}.[4]

CAL further modified the for loop by adding conditional exits, using WHILE and UNTIL. For instance, {{{1}}} or {{{1}}}. In the later case, the BY is assumed to be 1.[4]

Notes

  1. ^ Lampson, "Systems", Research, Microsoft.
  2. ^ Manual 1968, p. 12.
  3. ^ Manual 1968, p. 14.
  4. ^ a b Manual 1968, p. 13.