Text Editor and Corrector
Encyclopedia
TECO is a text editor
Text editor
A text editor is a type of program used for editing plain text files.Text editors are often provided with operating systems or software development packages, and can be used to change configuration files and programming language source code....

 originally developed at the Massachusetts Institute of Technology
Massachusetts Institute of Technology
The Massachusetts Institute of Technology is a private research university located in Cambridge, Massachusetts. MIT has five schools and one college, containing a total of 32 academic departments, with a strong emphasis on scientific and technological education and research.Founded in 1861 in...

 (MIT) in the 1960s, after which it was modified by 'just about everybody'. With all the dialects included, TECO may have been the most popular editor in use before the vi
Vi
vi is a screen-oriented text editor originally created for the Unix operating system. The portable subset of the behavior of vi and programs based on it, and the ex editor language supported within these programs, is described by the Single Unix Specification and POSIX.The original code for vi...

 editor (later included with many Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s) , and before the Emacs
Emacs
Emacs is a class of text editors, usually characterized by their extensibility. GNU Emacs has over 1,000 commands. It also allows the user to combine these commands into macros to automate work.Development began in the mid-1970s and continues actively...

 editor, to which TECO was directly ancestral ('Emacs' originally stood for Editing MACroS running on TECO).

Description and impact

TECO is not just an editor, but an interpreted programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 for text manipulation. Arbitrary programs (called 'macros') for searching and modifying text give it great power. Unlike regular expressions, however, the language was imperative
Imperative programming
In computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state...

 (though some versions had an 'or' operator in string search).

TECO does not really have syntax
Syntax
In linguistics, syntax is the study of the principles and rules for constructing phrases and sentences in natural languages....

; each character in a program is an imperative command, dispatched to its corresponding routine. That routine may read further characters from the program stream (giving the effect of string arguments), change the position of the 'program counter' (giving the effect of control structures), or push values onto a value stack (giving the effect of nested parentheses). But there is nothing to prevent operations like jumping into the middle of a comment, since there is no syntax and no parsing.

A classic essay on computer programming, Real Programmers Don't Use Pascal
Real Programmers Don't Use Pascal
"Real Programmers Don't Use Pascal" is an essay about computer programming written by Ed Post of Tektronix, Inc., and published in July 1983 as a letter to the editor in Datamation....

, suggested that a common game for TECO fans was to enter their name as a command sequence, and then try to work out what would happen. The same essay in describing TECO coined the acronym "YAFIYGI", meaning "You Asked For It You Got It" and thus being the antitheses of WYSIWYG
WYSIWYG
WYSIWYG is an acronym for What You See Is What You Get. The term is used in computing to describe a system in which content displayed onscreen during editing appears in a form closely corresponding to its appearance when printed or displayed as a finished product...

 ("What You See Is What You Get").

Richard Stallman
Richard Stallman
Richard Matthew Stallman , often shortened to rms,"'Richard Stallman' is just my mundane name; you can call me 'rms'"|last= Stallman|first= Richard|date= N.D.|work=Richard Stallman's homepage...

's now-famous Emacs
Emacs
Emacs is a class of text editors, usually characterized by their extensibility. GNU Emacs has over 1,000 commands. It also allows the user to combine these commands into macros to automate work.Development began in the mid-1970s and continues actively...

 editor was originally implemented in TECO (later versions of Emacs, first Multics
Multics
Multics was an influential early time-sharing operating system. The project was started in 1964 in Cambridge, Massachusetts...

 Emacs and then GNU
GNU
GNU is a Unix-like computer operating system developed by the GNU project, ultimately aiming to be a "complete Unix-compatible software system"...

 Emacs, were implemented in Lisp
Lisp programming language
Lisp is a family of computer programming languages with a long history and a distinctive, fully parenthesized syntax. Originally specified in 1958, Lisp is the second-oldest high-level programming language in widespread use today; only Fortran is older...

 and Emacs Lisp
Emacs Lisp
Emacs Lisp is a dialect of the Lisp programming language used by the GNU Emacs and XEmacs text editors . It is used for implementing most of the editing functionality built into Emacs, the remainder being written in C...

). TECO became well-known following a Digital Equipment Corporation
Digital Equipment Corporation
Digital Equipment Corporation was a major American company in the computer industry and a leading vendor of computer systems, software and peripherals from the 1960s to the 1990s...

 (DEC) PDP-6
PDP-6
The PDP-6 was a computer model developed by Digital Equipment Corporation in 1963. It was influential primarily as the prototype for the later PDP-10; the instruction sets of the two machines are almost identical.The PDP-6 was DEC's first "big" machine...

 mainframe implementation developed at MIT's Project MAC in 1964. This implementation continuously displayed the edited text visually on a CRT
Cathode ray tube
The cathode ray tube is a vacuum tube containing an electron gun and a fluorescent screen used to view images. It has a means to accelerate and deflect the electron beam onto the fluorescent screen to create the images. The image may represent electrical waveforms , pictures , radar targets and...

 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
PDP-1
The PDP-1 was the first computer in Digital Equipment Corporation's PDP series and was first produced in 1960. It is famous for being the computer most important in the creation of hacker culture at MIT, BBN and elsewhere...

 computer, the Incompatible Timesharing System
Incompatible Timesharing System
ITS, the Incompatible Timesharing System , was an early, revolutionary, and influential time-sharing operating system from MIT; it was developed principally by the Artificial Intelligence Laboratory at MIT, with some help from Project MAC.In addition to being technically influential ITS, the...

 (ITS) on the PDP-6 and PDP-10
PDP-10
The PDP-10 was a mainframe computer family manufactured by Digital Equipment Corporation from the late 1960s on; the name stands for "Programmed Data Processor model 10". The first model was delivered in 1966...

 mainframe, and TOPS-10
TOPS-10
The TOPS-10 System was a computer operating system from Digital Equipment Corporation for the PDP-10 mainframe computer launched in 1967...

 and TOPS-20
TOPS-20
The TOPS-20 operating system by Digital Equipment Corporation was the second proprietary OS for the PDP-10 mainframe computer. TOPS-20 began in 1969 as the TENEX operating system of Bolt, Beranek and Newman...

 on the PDP-10
PDP-10
The PDP-10 was a mainframe computer family manufactured by Digital Equipment Corporation from the late 1960s on; the name stands for "Programmed Data Processor model 10". The first model was delivered in 1966...

.
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
RSTS/E
RSTS is a multi-user time-sharing operating system, developed by Digital Equipment Corporation , for the PDP-11 series of 16-bit minicomputers. The first version of RSTS was implemented in 1970 by DEC software engineers that developed the TSS-8 time-sharing operating system for the PDP-8...

 was implemented as a multi-user run-time system
Run-time system
A run-time system is a software component designed to support the execution of computer programs written in some computer language...

 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
RSTS/E
RSTS is a multi-user time-sharing operating system, developed by Digital Equipment Corporation , for the PDP-11 series of 16-bit minicomputers. The first version of RSTS was implemented in 1970 by DEC software engineers that developed the TSS-8 time-sharing operating system for the PDP-8...

 and VAX
VAX
VAX was an instruction set architecture developed by Digital Equipment Corporation in the mid-1970s. A 32-bit complex instruction set computer ISA, it was designed to extend or replace DEC's various Programmed Data Processor ISAs...

 systems with terminals capable of direct-cursor control (e.g. VT52
VT52
The VT52 was a CRT-based computer terminal produced by Digital Equipment Corporation introduced in September, 1975 . It provided a screen of 24 rows and 80 columns of text and supported all 95 ASCII characters as well as 32 graphics characters. It supported asynchronous communication at baud rates...

 and VT100
VT100
The VT100 is a video terminal that was made by Digital Equipment Corporation . Its detailed attributes became the de facto standard for terminal emulators.-History:...

) to provide a full-screen visual editor similar in function to the contemporaneously developed Emacs
Emacs
Emacs is a class of text editors, usually characterized by their extensibility. GNU Emacs has over 1,000 commands. It also allows the user to combine these commands into macros to automate work.Development began in the mid-1970s and continues actively...

.

Hewlett-Packard
Hewlett-Packard
Hewlett-Packard Company or HP is an American multinational information technology corporation headquartered in Palo Alto, California, USA that provides products, technologies, softwares, solutions and services to consumers, small- and medium-sized businesses and large enterprises, including...

, having bought Compaq
Compaq
Compaq Computer Corporation is a personal computer company founded in 1982. Once the largest supplier of personal computing systems in the world, Compaq existed as an independent corporation until 2002, when it was acquired for US$25 billion by Hewlett-Packard....

 (who bought Digital Equipment Corporation
Digital Equipment Corporation
Digital Equipment Corporation was a major American company in the computer industry and a leading vendor of computer systems, software and peripherals from the 1960s to the 1990s...

), still provides TECO with the OpenVMS
OpenVMS
OpenVMS , previously known as VAX-11/VMS, VAX/VMS or VMS, is a computer server operating system that runs on VAX, Alpha and Itanium-based families of computers. Contrary to what its name suggests, OpenVMS is not open source software; however, the source listings are available for purchase...

 operating system.

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
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

/Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 environment.

History

TECO was originally developed at MIT circa 1963 by Daniel L. Murphy for use on two PDP-1
PDP-1
The PDP-1 was the first computer in Digital Equipment Corporation's PDP series and was first produced in 1960. It is famous for being the computer most important in the creation of hacker culture at MIT, BBN and elsewhere...

 computers, belonging to different departments, both housed in MIT's Building 26. On these machines, the normal development process involved the use of a Friden Flexowriter
Friden Flexowriter
The Friden Flexowriter was a teleprinter, a heavy duty electric typewriter capable of being driven not only by a human typing, but also automatically by several methods including direct attachment to a computer and by use of paper tape....

 to prepare source code offline on a continuous strip of punched paper tape. Programmers of the big IBM mainframe
IBM mainframe
IBM mainframes are large computer systems produced by IBM from 1952 to the present. During the 1960s and 1970s, the term mainframe computer was almost synonymous with IBM products due to their marketshare...

s customarily punched their source code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

 on card
Punched card
A punched card, punch card, IBM card, or Hollerith card is a piece of stiff paper that contains digital information represented by the presence or absence of holes in predefined positions...

s, using key punch
Key punch
A keypunch is a device for manually entering data into punched cards by precisely punching holes at locations designated by the keys struck by the operator. Early keypunches were manual devices. Later keypunches were mechanized, often resembled a small desk, with a keyboard similar to a...

es 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 named "Expensive Typewriter
Expensive Typewriter
Expensive Typewriter was a text editing program that ran on the DEC PDP-1 computer that had been recently delivered at MIT. Since it could drive an IBM Selectric typewriter , it may be considered the first word processing program, although it was not WYSIWYG, having no CRT display. It was written...

". 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
Colossal Typewriter
Colossal Typewriter by John McCarthy and Roland Silver was one of the earliest computer text editors. The program ran on the PDP-1 at Bolt, Beranek and Newman by December 1960....

". 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
Expensive Desk Calculator
Expensive Desk Calculator by Robert A. Wagner is thought to be computing's first interactive calculation program.The software first ran on the TX-0 computer loaned to the Massachusetts Institute of Technology by Lincoln Laboratory...

, 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 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, a special Version of TECO (TECO-6) had been implemented on the PDP-6
PDP-6
The PDP-6 was a computer model developed by Digital Equipment Corporation in 1963. It was influential primarily as the prototype for the later PDP-10; the instruction sets of the two machines are almost identical.The PDP-6 was DEC's first "big" machine...

 at MIT. 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. Amongst the creators of TECO-6 were Richard Greenblatt
Richard Greenblatt (programmer)
Richard D. Greenblatt is an American computer programmer. Along with Bill Gosper, he may be considered to have founded the hacker community, and holds a place of distinction in the Lisp and the MIT AI Lab communities.-Childhood:...

 and Stewart Nelson.

At MIT, TECO development continued in the fall of 1971. Carl Mikkelsen had implemented a real-time edit mode loosely based on the TECO-6 graphic console commands, but working with the newly installed Datapoint
Datapoint
Datapoint Corporation, originally known as Computer Terminal Corporation , was a computer company based in San Antonio, Texas, United States. Founded in 1967 by Phil Ray and Gus Roche, its first products were, as the company's initial name suggests, computer terminals...

-3300 CRT text displays. The TECO buffer implementation, however, was terribly inefficient for processing single character insert or delete functions—editing consumed 100% of the PDP-10. With Richard Greenblatt
Richard Greenblatt (programmer)
Richard D. Greenblatt is an American computer programmer. Along with Bill Gosper, he may be considered to have founded the hacker community, and holds a place of distinction in the Lisp and the MIT AI Lab communities.-Childhood:...

's support, in summer of 1972 Carl reimplemented the TECO buffer storage and reformed the macros as native PDP-10 code. As entering the real-time mode was by typing <cntl>-R, this was known as control-R mode. At the same time, Rici Liknaitski added input-time macros (<cntl>-]), which operated as the command string was read rather than when executed. Read-time macros made the TECO auxiliary text buffers, called Q-registers, more useful. Carl expanded the Q-register name space. With read-time macros, a large Q-register name space, and efficient buffer operations, the stage was set for binding each key to a macro. These edit macros evolved into Emacs
Emacs
Emacs is a class of text editors, usually characterized by their extensibility. GNU Emacs has over 1,000 commands. It also allows the user to combine these commands into macros to automate work.Development began in the mid-1970s and continues actively...

.

Example session

Given a file named hello.c with the following contents:

int main(int argc, char **argv)
{
printf("Hello world!\n");
return 0;
}

one could use the following TECO session (noting that the prompt is "*" and "$" is how ESC is echoed) to change "Hello" into "Goodbye":

  • EBhello.c$$ Open file for read/write with backup
  • P$$ Read in the first page
  • SHello$0TT$$ Search for "Hello" and print the line

printf("Hello world!\n"); The line
  • -5DIGoodbye$0TT$$ Delete "Hello", insert "Goodbye", and print the line

printf("Goodbye world!\n"); The updated line
  • EX$$ Copy the remainder of the file and exit


Example 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)

The programming language

The obscurity of the TECO programming language is well-described in the following quote from Real Programmers Don't Use PASCAL, a letter from Ed Post to Datamation, July 1983, pp. 263–265:
"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."
According to Craig Finseth, author of The Craft of Text Editing, TECO could be considered to be one of the first "write-only
Write-only language
A write-only language is a programming language with syntax sufficiently dense and bizarre that any routine of significant size is automatically write-only code...

" 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.

Despite the odd syntax, the TECO command language was tremendously powerful, and clones are still available for MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

 and for Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

.

TECO commands are characters (including control-characters), and the prompt is a single asterisk:
*

The escape key displays as a dollar sign, pressed once it delineates the end of a command requiring an argument and pressed twice initiates the execution of the entered command(s):
*$$

Example programs

The first two examples are 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
Goto
goto is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control...

" and "structured
Structured programming
Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...

" version are shown. Note that TECO ignores case
Letter case
In orthography and typography, letter case is the distinction between the larger majuscule and smaller minuscule letters...

 and whitespace (except tab
Tab
Tab or tabs may refer to:* Tab, a British Army term for a loaded march* Tab , by Monster Magnet* Tab , a small protective covering for the fingers* Tab , the mechanism for opening a beverage can...

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

Example 3

This example is a Brainfuck
Brainfuck
The brainfuck programming language is an esoteric programming language noted for its extreme minimalism. It is a Turing tarpit, designed to challenge and amuse programmers, and is not suitable for practical use...

 interpreter for TECO. It works by executing the buffer as a Brainfuck program, and demonstrates the capabilities of the editor.

@^UB#@S/{^EQQ,/#@^UC#@S/,^EQQ}/@-1S/{/#@^UR#.U1ZJQZ\^SC.,.+-^SXQ-^SDQ1J#@^U9/[]-+<>.,/<@:-FD/^N^EG9/;>J30000<0@I/
/>ZJZUL30000J0U10U20U30U60U7@^U4/[]/@^U5#<@:S/^EG4/U7Q7;-AU3(Q3-91)"=%1|Q1"=.U6ZJ@i/{/Q2\@i/,/Q6\@i/}/Q6J0;'-1%1'
>#<@:S/[/UT.U210^T13^TQT;QT"NM5Q2J'>0UP30000J.US.UI<(0A-43)"=QPJ0AUTDQT+1@I//QIJ@O/end/'(0A-45)"=QPJ0AUTDQT-1@I//
QIJ@O/end/'(0A-60)"=QP-1UP@O/end/'(0A-62)"=QP+1UP@O/end/'(0A-46)"=-.+QPA^T(-.+QPA-10)"=13^T'@O/end/'(0A-44)"=^TUT
8^TQPJDQT@I//QIJ@O/end/'(0A-91)"=-.+QPA"=QI+1UZQLJMRMB\-1J.UI'@O/end/'(0A-93)"=-.+QPA"NQI+1UZQLJMRMC\-1J.UI'@O/en
d/'!end!QI+1UI(.-Z)"=.=@^a/END/^c^c'C>

Example 4

This example calculates pi
Pi
' is a mathematical constant that is the ratio of any circle's circumference to its diameter. is approximately equal to 3.14. Many formulae in mathematics, science, and engineering involve , which makes it one of the most important mathematical constants...

to an arbitrary number of digits.

GZ0J\UNQN"E 40UN ' BUH BUV HK
QN< J BUQ QN*10/3UI
QI< \+2*10+(QQ*QI)UA B L K QI*2-1UJ QA/QJUQ
QA-(QQ*QJ)-2\ 10@I// -1%I >
QQ/10UT QH+QT+48UW QW-58"E 48UW %V ' QV"N QV^T ' QWUV QQ-(QT*10)UH >
QV^T @^A/
/HKEX$$

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK