Approximate Pi
1'SQR'2'P2
2'.'2'P2'P2
3';'2'P
4'Z'N'2'16
5'.'2'P'P
6'/'P2'P'P2
7'.'P2'P2'P2
8'-'1'P2'P2
9'SQR'P2'P2
10'-'1'P2'P2
11'.'2'P2'P2
12'SQR'P2'P2
13'.'P'P2'P2
14'P'N
15'P'P2
16'N
17'E
Load Example
DOPE's syntax is pretty simple, each line is formatted as:
line_number'instruction'arg1'arg2'arg3'arg4'arg5
So yeah, as per spec tokens are seperated by a single quote. The interpreter works in a similar way to BASIC enviroments. LIST lists a program, RUN runs a program, SAVE will prompt a download, while LOAD with prompt an upload. Enter lines of code with a line number followed by your code, or just click on some of the prepared examples and hammer in RUN.
Instruction | Arg 1 | Arg 2 | Arg 3 | Arg 4 | Arg 5 | Description |
---|---|---|---|---|---|---|
+ | A | B | C | C = A + B | ||
- | A | B | C | C = A - B | ||
- | A | B | C | C = A - B | ||
* | A | B | C | C = A * B | ||
/ | A | B | C | C = A / B | ||
; | A | B | B = A | |||
SQR | A | B | B = SQRT(A) | |||
LOG | A | B | B =ln(A) | |||
EXP | A | B | B =e^A | |||
SIN | A | B | B = SINE(A) | |||
C | A | B | L1 | L2 | L3 |
Conditional Jump If(A > B) jump to L1 If(A == B) jump to L2 If(A < B) jump to L3 |
T | L | Jump TO line L | ||||
A | X | Print "label" X, only way to print a string literal | ||||
P | A | Print the value of A | ||||
N | Print a newline | |||||
J | A | Get numeric input from user, store in A | ||||
Z | A | B | C | For A = B to C, execute following code | ||
E | End of loop, basically jumps to closest Z | |||||
F | End of program | |||||
S | "Start computing", used at absolute end of progam. Not relevant outside original implementation |
DOPE(Dartmouth Oversimplified Programming Experiment) was the direct predecessor to BASIC. The language was developed by John Kemeny and Sydney Marshall in 1962. Through the 50s and 60s Kemeny and his colleague, Thomas Kurtz, had been trying to find a way to teach non-science majors about computers. DOPE was the latest attempt, an experimental language designed for the novice programmer. It was used in a single class in '62. This wasn't a failure, it was by design. Hence the 'E' in DOPE. Despite its short life DOPE was an important proving ground for ideas that would come to shape BASIC. And for years it has remained somewhat enigmatic... at least until now!
I host a podcast called Advent of Computing that covers, what else, the history of the computer. Recently I was gathering information for an episode on BASIC when I ran into a strange hole in the sources. Kemeny and Kurtz mention DOPE in interviews, papers, and books. There is even a small example program tucked away in an article written by Kurtz. But besides the mentions and a few lines of code there isn't all that much out there about DOPE. That kind of missing information doesn't sit well with me, so I set about fixing it. I was able to track down the original paper describing DOPE in Dartmouth's archive and get a copy digitized. As far as I'm concerned that paper, simply titled "Dartmouth Oversimplified Programming Experiment", is the authoritative source on the language.
Once I tracked down the details my next step was clear: preservation and resurrection. As near as I can tell DOPE was only used for one term at Dartmouth, and I haven't been able to find the original compiler for the language. With direct emulation out of the question my only option was to write my own implementation of the long-dead language. So I present to you DOPE-20, a mostly accurate implementation of language. I intend this as a way to recreate a bit of lost history. DOPE was never built for serious programming, but by examining the language we can get deeper insight into the development of BASIC. Think of it as Jurassic Park, but the dinosaur here is comprised of bits and bytes.
DOPE-20 is relatively accurate to the source material, but there are some major caveats that bear mentioning. As of today I am the world's preeminent DOPE expert, the DOPE lord if you like, so I've taken some liberties with my implementation. Most of these were done to make it more accessible to a wider audience, something that would be in line with the language's original goals. The biggest change is the interface. The machine that ran DOPE, an LGP-30, did have a teletype terminal so it's possible DOPE was typed into the machine. More likely it was punched onto paper tape and loaded into the machine. However, I've expanded things out to a more DTSS/BASIC like command line interface. This probably isn't period accurate, but I think it's a reasonable departure. I also have no evidence that DOPE used a line number based editing interface. Given the time period I doubt there was really any text editing interface.
I've also done away with a lot of the restrictions of the original language. Per the spec a DOPE program can only be 99 lines long, variables have hard upper and lower values, and to get around that scientific notation can be used. All of those limitations were in place due to the small capacity of the LGP-30 computer. The spirit behind DOPE(and yes, BASIC too) is that arbitrary limitations are a hinderance, so I decided to stick to that mantra. Another large change is that DOPE-20 is interpreted, not compiled. The 1962 implementation used a compiler, and Kemeny and Kurtz are in general very anti-interpreter. I chose implement DOPE-20 in an interpreted environment so it's a little more accessible. The entire interpreter is written in JavaScript, that way curious users can just load up a webpage and check out the language. It wouldn't be very hard to write a DOPE compiler, but then you'd have to be a little more tech savvy to experience the language. Once again, I think this is in keeping with the spirit of DOPE as a language for non-programmers.
Sources: