Text Editor and Corrector

From Academic Kids

TECO (pronounced /tee'koh/; originally an acronym for [paper] Tape Editor and COrrector, but later Text Editor and COrrector) was a text editor developed at MIT in the 1960s and modified by 'just about everybody'. With all the dialects included, TECO may have been the most prolific editor in use before vi as well as Emacs, to which it was directly ancestral ('Emacs' originally standing for editing macros running on TECO).


Description and impact

TECO, noted for its complex syntax, can be considered a general-purpose, interpreted programming language targeted for text manipulation. Almost every character is a command—a 1- or 2-character sequence replaces the usual keywords of more verbose languages—thus any character string is a TECO program, although not necessarily a useful one. One common game used to be mentally working out what the TECO commands corresponding to human names did.

Richard Stallman's original Emacs was implemented in TECO. However, later versions of Emacs, first Multics Emacs and then GNU Emacs, were implemented in Lisp and Emacs Lisp. TECO became well-known following a DEC PDP-6 implementation developed at MIT's Project MAC circa 1966. 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, ITS on the PDP-6 and PDP-10, and TOPS-10 and TOPS-20 on the PDP-10. A descendant of the version DEC distributed for the PDP-10 is still available on the Internet, along with several partial implementations for the MS-DOS / Windows environment. 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 actually implemented as a multi-user "RunTime System" and could be used as the user's complete operating environment; you never had to actually exit TECO! HP, having bought Compaq/DEC, still provides TECO with VMS.


TECO was originally developed at MIT circa 1963 by Daniel L. Murphy for use on two PDP-1 computers, belonging to different departments, both housed in Building 26. On these machines, the normal development process involved the use of a Friden Flexowriter to prepare source code offline on a continuous strip of punched paper tape. Programmers of the big IBM mainframes customarily punched their source code on cards, using key punches which printed human-readable dot-matrix characters along the top of every card at the same time as they punched each machine-readable character. Thus IBM programmers could read, insert, delete, and move lines of code by physically manipulating the cards in the deck. Punched paper tape offered no such amenities, and necessity was the mother of online editing.

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 "Collosal Typewriter". Even in those days, on-line editing could save one 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.

Example TECO code

Code sampleExplanation
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)

Example TECO programs

This is a simple interchange sort of the current text buffer, based on the 1st character of each line, taken from the PDP-11 TECO User's Guide. A "goto" and "structured" version are shown. Note that TECO ignores case and whitespace (except tab, which is an insertion command).

Example 1

 !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 !

Example 2

 0uz                             ! clear repeat flag !
 <j 0aua l                       ! load 1st char into register A !
 <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 !

TECO Trivia

  • 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?".
  • TECO was considered to be one of the first "Write-only" languages. That is, you could write a program in TECO, but it was unlikely that you could look at an arbitrary TECO program and precisely describe what it did. (More recently, APL and Forth have earned this dubious distinction.)
  • 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!"

See also


  • TECO pocket guide. Digital Equipment Corporation, 1978. Order No. AV-D530A-TK. 17 pp. [1] (

External links

This article is based on an entry in the Jargon File, which is in the public


Academic Kids Menu

  • Art and Cultures
    • Art (
    • Architecture (
    • Cultures (
    • Music (
    • Musical Instruments (
  • Biographies (
  • Clipart (
  • Geography (
    • Countries of the World (
    • Maps (
    • Flags (
    • Continents (
  • History (
    • Ancient Civilizations (
    • Industrial Revolution (
    • Middle Ages (
    • Prehistory (
    • Renaissance (
    • Timelines (
    • United States (
    • Wars (
    • World History (
  • Human Body (
  • Mathematics (
  • Reference (
  • Science (
    • Animals (
    • Aviation (
    • Dinosaurs (
    • Earth (
    • Inventions (
    • Physical Science (
    • Plants (
    • Scientists (
  • Social Studies (
    • Anthropology (
    • Economics (
    • Government (
    • Religion (
    • Holidays (
  • Space and Astronomy
    • Solar System (
    • Planets (
  • Sports (
  • Timelines (
  • Weather (
  • US States (


  • Home Page (
  • Contact Us (

  • Clip Art (
Personal tools