I started another new Wikipedia article, this one on DOPE. The example programs below aren’t in the Wikipedia article, as they are just speculation.
|Designed by||John G. Kemeny|
|First appeared||1962; 58 years ago|
|DARSIMCO, DART, Dartmouth ALGOL 30, Fortran|
DOPE, short for Dartmouth Oversimplified Programming Experiment, was a simple programming language designed by John Kemény in 1962 to offer students a transition from flow-charting to programming the LGP-30. Lessons learned from implementing DOPE were subsequently applied to the invention and development of BASIC.
Each statement was designed to correspond to a flowchart operation and consisted of a numeric line number, an operation, and the required operands:
7 + A B C 10 SIN X Z
The final variable specified the destination for the computation. The above program corresponds in functionality to the later BASIC program:
7 LET C=A+B 10 LET Z=SIN(X)
The language was case insensitive.
Variable names were a single letter A to Z, or a letter followed by a digit (A0 to Z9). As with Fortran, different letters had different representations. Variables starting with letters A to D were floating point, as were variables from I to Z; variables E, F, G, and H each were defined as vectors with components from 1 to 16.
|Operation||Function||Number of operands|
|A||Ask (prompt for input)||2|
|J||Input into variable||1|
|N||Print a newline||(Unknown)|
|P||Print a variable||1|
|EXP||E to the power||2|
According to Thomas Kurtz, a co-inventor of BASIC, “Though not a success in itself, DOPE presaged BASIC. DOPE provided default vectors, default printing formats, and general input formats. Line numbers doubled as jump targets.”
The language had a number of other features and innovations that were carried over into BASIC:
- Variable names were either a letter or a letter followed by a digit
- Arrays (vectors) did not have to be declared and had a default size (16 instead of 10)
- Every line required a numeric label*
- Lines were sorted in numeric order*
- Every line begin with a keyword*
- Function names were three letters long*
- The only loop construct was a for-loop
- DARSIMCO, ‘Dartmouth Simplified Code’, a 1956 assembler macro language
- Dartmouth ALGOL 30, a compiler developed by Dartmouth for the LGP-30
- Kurtz, Thomas (1981). “BASIC”. History of programming languages. History of programming languages I. ACM. pp. 517-518 517–518. doi:10.1145/800025.1198404. ISBN 0-12-745040-8.
- Williams, Michael (November 1, 1985). A History of Computing Technology (1st ed.). Prentice-Hall. p. 432. ISBN 0133899179.
- Application to the National Science Foundation, Kurtz, Rieser, and Meck, cited in Rankin, pages 20-21
- Kemeny, John G.; Kurtz, Thomas E. (1985). Back To BASIC: The History, Corruption, and Future of the Language. Addison-Wesley Publishing Company, Inc. 141 pp. ISBN 0-201-13433-0
The following sample programs are conjectures based on what little has been published about the language. For reference programs, I turned to the 1964 manual for BASIC.
BASIC program (page 13):
10 FOR X = 2 TO 100 STEP 2 20 PRINT X, SQR(X) 30 NEXT X 40 END
Equivalent DOPE program:
10 Z X 2 15 SQR X S 20 P X 21 P S 25 N 30 E X 2 100
BASIC program (page 42):
10 REM COMPUTE A TABLE OF VALUES OF SINE FUNCTION IN DEGREES 20 LET P = 3.14159265/180 30 FOR X = 0 TO 90 40 PRINT X, SIN(X*P) 50 NEXT X 60 END
Equivalent DOPE program:
20 / 3.14159265 180 P 30 Z X 0 35 * X P S 36 SIN S S 40 P X S 45 N 50 E X 1 90
Adapted from the BASIC program on page 25 (which used READ and DATA instead of INPUT, which wasn’t even in the language yet; fun fact, a READ with no DATA simply ended the program):
5 PRINT "X VALUE", "SINE", "RESOLUTION" 10 READ D 20 LET M = -1 30 FOR X = 0 TO 3 STEP D 40 IF SIN(X) <= M THEN 80 50 LET X0 = X 60 LET M = SIN(X) 80 NEXT X 85 PRINT X0, M, D 90 GOTO 10 100 DATA .1, .01, .001 110 END
For DOPE, you would need to enter each value one at a time… .1, .01, .001:
5 P 'X VALUE 6 P 'SINE 7 P 'RESOLUTION 10 J D 20 – 0 1 M 30 Z X 0 35 SIN X S 36 – M S S 40 C M 80 80 50 50 + 0 X X0 60 SIN X M 80 E X D 3 85 P X0 86 P M 87 P D 88 N 90 T 10
- The notation for the print command P is taken from the convention the ACT-III programming language used of delimiting tokens with an apostrophe. I assumed it took one operand (variable or delimited quote).
- The for-loop format is assumed to be Z loopvariable startingvalue and E loopvariable increment lastvalue. Since BASIC’s NEXT includes the loop variable, I assume this command does as well; I put the increment and last value in the E command because that would be easier for a programmer to implement than doing the test on the Z command. In this scenario, though, the loop will always execute once, which it didn’t do in 1964 BASIC.
- The arithmetic IF format copies FORTRAN in format: C expression negative zero positive, specifying the three line numbers to jump to depending upon the condition. Dissatisfaction with this notation led to the IF-THEN statement in BASIC, according to Kurtz.
- No command was specified by Kurtz for assigning a constant to a variable. That was probably an oversight in his terse summary of the language, but in the example above I used + 0 to accomplish this.