The last TECO user?

That might be me, but more likely I am one of a small group.

What is TECO? In a few words, “a text editor which is also a complete programming language”. There is a fine and entertaining overview in this memoir by Dan Murphy, the original author; you can also take a look at what Wikipedia has to say.

TECO—in fact, my own implementation thereof—is still the text editor I use every day. Here’s how that came about.

Back in the 70’s and 80’s I used TECO in various forms on PDP-10 systems, including a version that I think was called ‘TV’ in which the upper portion (about 18 lines) of a terminal screen displayed a window into the buffer being editing, while the lower portion displayed the current command as typed.

This was the model for my first reimplementation, for the Atari ST, in 68000 assembly language. This was part of a larger program—about 50K bytes in total, as I remember it—that incorporated a 68000 assembler and disassembler, some primitive debugging facilities, a simple command line and a few internally-coded commands (list a directory, for example), and a terminal emulator.

A few years later, when faced with a job where I was using an 8086-type machine, I made a second assembly-language implementation that used a swap file and other mechanisms to hide that architecture’s nasty 64K limit on contiguous arrays.

Finally I was able to move to a third version, written in CWEB, Donald Knuth’s admirable ‘Literate Programming’ dialect of  C. This is what I use today, on both Linux and OS X.

Catering only for myself, I never felt the need to implement all the obscure commands that made their way into TECO. My versions have always been whole-file editors, disregarding the read-a-page / write-a-page cycle that was part of the original. I have always treated the command language as case-sensitive; by making capital letters available in their own right this in turn avoids the need for the two-character ‘Ex’ and ‘Fx’ commands used by ‘classic TECO’.

In further nods toward modern programming practice (and sanity) I never implemented the GOTO command, relying only on loops (and loop exits) and conditionals. Even though TECO’s native command language is basically a kind of bytecode, my versions have always ‘compiled’ the entire command string into a second version for interpretation; this has the advantage that if there is a (detectable) typo it can be caught before making any changes to the editing buffer.

[added 2017-05-02]: One innovation that I made in my versions (even, I think, the first, Atari ST version—but I have no way to check right now) was that the four keys ‘[’, ‘]’, ‘;’, and ‘'’, which form a little grid toward the right end of the QWERTY keyboard, become immediate-action commands that cause the displayed window on the buffer to scroll. (None of them are needed as the first character of a legitimate command string, as it happens.) ‘[’ brings in a new line at the top of the window (‘scroll down’) while ‘;’ brings in a new line at the bottom of the window (‘scroll up’); ‘]>’ and ‘'’ are ‘page down’ and ‘page up’. Note that unlike many editors these scrolling actions do not affect the location of ‘point’ (where editing happens), and in fact can leave the window in a state where ‘point’ is not displayed. An empty command (double-ESC) will redraw the window centered on the current position of ‘point’. Having done this, it made sense to add ‘/’ (also not needed at the beginning of a command string) to mean “Please move ‘point’ to the middle of the window as currently displayed.”

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to The last TECO user?

  1. Depaver Jan says:

    Hi Phil, Although I was never a programmer, I can relate to your experience because I was right there on the periphery of early systems for the computerized data industry. In 1970 our family business had an IBM 360, in a cooled room. I was 19 when I started working there, and the key information for my department was gasoline sales by brand by state by month. I could relate to the information, and was not hindered by not being a programmer. In 1971 I took a computer language course at UCLA: PL1. I had a problem with the subject and presentation, because I was forced to memorize arbitrary details; French made more sense to me. My progress in the course was also limited because all my classmates had taken FORTRAN prior to this class, which I found out after I flunked. I really had tried to pass. The university placed me on probation for a plummeting grade point average. I went to the professor in charge of the class; I’d never seen him before because the Teaching Assistant did everything. The professor said that I could request a grade change again in a year, so I said “Fine” and I left. It’s ironic that in my working careers I’ve relied on computers so much, but have not been able to get a hold of this key discipline and make it work as I should. I do well what I do on a computer, but I get easily stumped. There’s your Wednesday story! Jan

    >

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s