TECOEditorFamily

HomePage | RecentChanges | EditorIndex | TextEditorFamilies | Preferences

Showing revision 3
TECO, the T{ape|ext} Editor and Corrector, is unique in the field of computing: it is the missing link between a (family of) text editor(s) and a (family of) programming language(s). In technical terms, it is an imperative, Turing-complete programming language for editing text. By virtue of this fact (we'll get into what that means later), it is also very, very, very, very powerful. It's also both the oldest single editor and the oldest family of text editors in use today (rarely - albeit there's no reason why this should be so).

The central concept of TECO as a programming language is wonderful: it’s geared towards processing text by repeatedly finding text that matches a given pattern, taking a given action when it finds it, and then selecting the next pattern to look for. That’s a very natural, easy to understand way of writing programs to do text processing. TECO also does well as a vanilla text editor: every command (i.e. verb) is one character long, with appropriate numeric (i.e. adverb) and string (i.e. noun) arguments before and after respectively.

TECO is one of the most influential pieces of software ever written. If, by chance, you’ve ever heard of a little editor called EMACS---well, that was originally a set of editor macros for TECO (EMACS = Editor MACroS?).

Unfortunately, TECO has a reputation for clobbering documents should one not have mastered it fully. The most common reason given is the fact that its commands are all one character long, and that TECO syntax therefore looks like random line noise. A quick thought experiment will show that this is a gross oversimplification. Vi and Vim also have one-character commands, yet they can be learned within a day. The true reason is that until recently, no readily-available TECO had a visible text buffer (like Vi does), and of those that did (for DEC and HP mainframes), no TECO had a text buffer that updated in real time. To update the text buffer, one pressed Escape twice (which would execute all the commands "lined up"), and if there was a single error in the queue, well, tough luck.


Definition

A TECO has the following features:


History

Back in the years when the squishy chair in the Oval Office was warmed by the adipose derriere of one L.B.J., the text editor available on M.I.T.'s DEC PDP-1 (an early model of minicomputer) was called Expensive Typewriter. This editor justly deserved its name; it lacked even a search option or the ability to go backwards through one's document, and at the time, the operating system on the PDP-1 supported a single user. The only way to edit on the computer, then, inherently wasted very expensive time on an activity that could be done elsewhere far more profitably.

It should be noted here that IBM mainframes used stacks of punched cards to store documents, while DEC minis used a paper tape. All the text editors to come would emulate one of the two experiences. Punched cards held one line of 80 characters each and could be shuffled, inserted, and deleted at will---this is the same paradigm as is used by line editors. Tape, on the other hand, held a stream of any number of characters, but because a stream of tape has no line numbers or indeed lines, editing locations needed to be specified by location from the "top" (problematic for the user) or by context. In addition, if an error were found, the entire tape would have to be re-punched or cut-and-spliced---and splicing was difficult.

The confluence of these two Bad Things was even Worse. And so, TECO was born. TECO was the “Tape Editor and COrrector”: it was a Turing-complete programming language in which you could write programs to make your corrections. With TECO, it was easy to specify a context, search for it, and optionally move y positions up or down. Branches, looping, and conditionals (of which Turing-completeness is a side effect) added descriptive power to searches---on which TECO depends---so naturally, they were added.

Instead of editing "expensively", Dan Murphy hoped, you’d first examine the faulty text and prepare a TECO program "off-line", on a device known as a Friden Flexowriter (a cross between a keypunch and a typewriter). This way, the computer could be used for meaningful work at the same time. You would then feed the TECO program in to the computer through its "high-speed" (200 cps) reader, followed by the original tape (with errors). The TECO program would then automatically punch a corrected tape (at a "blistering" speed of 60 cps) or print the work to hand in. No time would be wasted in editing...

...or so it was thought. The human factor is fallible, and because the correction tape was a program, it required debugging just like any other. In practice, people continued to edit "expensively". The problem was approached from a different angle, with time-sharing operating systems (where the computer could be used by two or more people at once)---but because TECO was so much more feature-complete and efficient than Expensive Typewriter, it was here to stay.

Around this time, on the West Coast, a new operating system was being written. It was to be known as UNIX, and it would take the world by storm. The original editor on UNIX, Ed, was written in 1969. Eventually, it was subsumed into Em (the Editor for Mortals), Ex (the Extended editor), and finally Vi (the Visual editor). UNIX, and its associated utilities, were written in the C programming language, which is portable; the original lineage of TECO was written in PDP assembly, which isn't. Ed (and therefore Vi) is similar to TECO in that their commands are generally one letter long. TECO, however, uses a "stream of tape" metaphor, Ed and Vi use the box-of-cards.

It is to be noted that Vi shares the same relationship with Ed as fullscreen TECO does with the command-line version. Like TECO, Vi is modal, but unlike TECO, it isn't Turing-complete. For instance, it is trivial to write an animation in ASCII graphics of a stick figure man juggling three balls; in Vi, such a thing is impossible.

It's worth noting that only in 1964 was any full-screen mode made available for TECO. Until then, 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. There was no "visual" TECO for DOS, Windows, Mac or UNIX until 1986.

Ten years earlier, in 1976, Richard M. Stallman, a hippie known for the GNU portion of GNU/Linux?, released the first version of Emacs (the Editor Macros for TECO) in co-ooperation with Guy Steele. Stallman and Steele evidently had a distaste for modal editors (that is, ones in which a command needs to be entered in order to insert text), because, like on a typewriter, pressing an unmodified key inserts the character into the buffer. All commands in Emacs involve pressing one or more of Escape, Meta, Alt, Control, and Shift at the same time as a letter or number key.

The shame of TECO’s death is that it was actually a really nice programming language. To this day, I still come across things that I need to do that are better suited to TECO than to any modern day programming language that I know. The problem though, and the reason that it’s disappeared so thoroughly, is that the *syntax* of TECO is so mind-bogglingly awful that no one, not even someone as insane as I am, would try to write code in it when there are other options available.

For example, -5@SwTEXTw? is a perfectly idiomatic way to say, search (s) backward (-) for the fifth occurrence (5) of the string quoted (@) by the letter w (wTEXTw) Similarly, 350,500FB

TECO-1, so named because it runs on the Digital PDP-1 mainframe, was written way back when the chair in the Oval Office was warmed by LBJ's butt; it was soon followed by TECO-10, TECO-11, and TECO-12

You can see it's not all that different from Vi or Vim:


HomePage | RecentChanges | EditorIndex | TextEditorFamilies | Preferences
Edit revision 3 of this page | View other revisions | View current revision
Edited March 21, 2018 12:13 am (diff)
Search: