Richard Stallman's now famous Emacs editor was originally implemented in TECO. (Later versions of Emacs, first Multics Emacs and then GNU Emacs, were implemented in Lisp and Emacs Lisp.) TECO became well-known following a Digital Equipment Corporation (DEC) PDP-6 minicomputer implementation developed at MIT's Project MAC in 1964. This implementation continuously displayed the edited text visually on a CRT screen, and was used as an interactive online editor. (This was, however, neither its origin nor its originally intended mode of use.) Later versions of TECO were capable of driving full-screen mode on various DEC RS232 video terminals.
TECO was available for several operating systems and computers, including the PDP-1 computer, the Incompatible Timesharing System (ITS) on the PDP-6 and PDP-10 minicomputers, and TOPS-10 and TOPS-20 on the PDP-10. A version of TECO was provided with all DEC operating systems; the version available for RT11 was able to drive the GT40 graphics display while the version available for RSTS/E was implemented as a multi-user run-time system and could be used as the user's complete operating environment; the user never actually had to exit TECO. The VTEDIT (Video Terminal Editor) TECO macro was commonly used on RSTS/E and VAX systems with terminals capable of direct-cursor control (e.g. VT52 and VT100) to provide a full-screen visual editor similar in function to the contemporaneously developed Emacs.
An early editor for the PDP-1 was (officially!) named "Expensive Typewriter." Written by Stephen D. Piner, it was the most rudimentary imaginable line-oriented editor, lacking even search-and-replace capabilities. Its name was chosen as a wry poke at an earlier, rather bloated, editor called "Colossal Typewriter". Even in those days, on-line editing could save time in the debugging cycle. Another program written by the PDP-1 hackers was Expensive Desk Calculator, in a similar vein.
The original stated purpose of TECO was to make more efficient use of the PDP-1. As envisioned in the manual, rather than performing editing "expensively" by sitting at a console, one would simply examine the faulty text and prepare a "correction tape" describing the editing operations to be performed on the text. One would efficiently feed the source tape and the correction tape into the PDP-1 via its high-speed (200 characters per second) reader. Running TECO, it immediately would punch an edited tape with its high-speed (60 characters per second) punch. One could then immediately proceed to load and run the assembler, with no time wasted in online editing.
TECO's then-sophisticated searching operations were motivated by the fact that the offline Flexowriter printouts were not line-numbered; therefore editing locations needed to be specified by context rather than by line number. The various looping and conditional constructs (which made TECO Turing-complete) were included in order to provide sufficient descriptive power for the correction tape. The terse syntax minimized the number of keystrokes needed to prepare the correction tape.
The correction tape was, in fact a program, and required debugging just like any other program. The pitfalls of even the simplest global search-and-replace soon became evident. In practice, TECO editing was performed online just as it had been with Expensive Typewriter (although TECO was certainly a more feature-complete editor than Expensive Typewriter, so editing was much more efficient with TECO). The original PDP-1 version had no screen display. The only way to observe the state of the text during the editing process was to type in commands that would cause the text (or portions thereof) to be typed out on the console typewriter.
By 1964, TECO had been implemented on the PDP-6. That version supported visual editing, i.e., used a screen display that shows the contents of the editing buffer in real time, updating as it changes.
and you wanted to change it to say "Goodbye" instead of "Hello". You might use a TECO session like this, noting that the prompt is "*" and "$" is how ESC is echoed:
printf("Hello world!n"); The line
printf("Goodbye world!n"); The updated line
|ER file $||open file for read access|
|[q ... ]q||push ... pop register Q (can hold number, text, or code)|
|< code >||iteration; there are codes for next, break, continue, etc.|
|n"X then-code | else-code'||if-then-else (X is a test type)|
"It has been observed that a TECO command sequence more closely resembles transmission line noise than readable text. One of the more entertaining games to play with TECO is to type your name in as a command line and try to guess what it does. Just about any possible typing error while talking with TECO will probably destroy your program, or even worse -- introduce subtle and mysterious bugs in a once working subroutine."
Teco commands are characters (including control-characters), and the prompt is a single star:
The escape key pressed twice terminated commands, and displayed as a dollar sign:
!START! j 0aua ! jump to beginning, load 1st char in register A !
!CONT! l 0aub ! load first char of next line in register B !
qa-qb"g xa k -l ga 1uz ' ! if A>B, switch lines and set flag in register Z !
qbua ! load B into A !
l z-."g -l @o/CONT/ ' ! loop back if another line in buffer !
qz"g 0uz @o/START/ ' ! repeat if a switch was made on last pass !
0uz ! clear repeat flag !
<0aub ! load 1st char of next line into B !qa-qb"g xa k -l ga -1uz ' ! if A>B, switch lines and set flag !qbua ! load B into A !l .-z;> ! loop back if another line in buffer !qz;> ! repeat if a switch was made last pass !
The next example is a Brainfuck interpreter for TECO. It works by executing the buffer as a Brainfuck program, and demonstrates the capabilities of the editor.
- Most DEC command languages interpreted the "MAKE filename" command as a command to start TECO and create the named filename. Many (most?) TECOs would respond to "MAKE LOVE" with the message "Not war?". At some TECO installation sites, the resulting file "LOVE" was considered a good-luck charm and was thus accorded heavy file protection (e.g., <777> under TOPS-10), never to be deleted.
- TECO could be considered to be one of the first "write-only" languages. That is, it could be argued that once a program is written in TECO, it would be extremely difficult to comprehend what it did without appropriate documentation.
- TECO's command line macro utility was called MUNG, which would execute the specified TECO program/macro on the specified input file. MUNG itself was one of the first recursive acronyms, standing for "MUNG Until No Good".
- When the VAX was introduced, DEC announced a more "user friendly" screen editor EDT to replace TECO. When users complained about the lack of support for their favorite editor, they were told "TECO is not an editor, it's a programming language!"
- One of the common sayings among exasperated TECO geeks was that it actually stood for Type Everything Completely Over.
- Dan Murphy's personal site
- Pete Siemsen's TECO collection
- Tom Almy's TECO page. Includes a TECO based on Pete Siemsen's TECOC and DECUS documentation. There are MS-DOS, Windows (console), Linux, Mac OS X, and OS/2 versions.
- Introduction to the TECO syntax
- TECO Information