TECO as a CGI Language??

Now this is just downright scary…

Tim Sneddon made a wisecrack about running TECO in a CGI environment – then decided to make it happen just for fun.

Aside from the fact that TECO on Itanium is notoriously unstable – this is totally insane (and wonderful!). As a language, TECO is almost certainly powerful enough; EMACS was originally written in TECO. It was this fact that got me started looking at TECO.

Tim shows how to set up WASD to run *.TEC files as TECO command files, and then provides an example.

Text Editors

Over at Hoff’s Blog, he recently discussed some thoughts he had about text editors. However, it was in the comments where I learned why TECO is so unstable on OpenVMS for Itanium. You wouldn’t think that anything in a shipping product would regularly do the equivalent of dump core – not to mention something as old and tested as TECO – but it’s true. Apparently TECO (being the old and unkillable beast that it is) wasn’t rewritten or debugged for Itanium, but rather was put on top of an emulation layer and translation layer, which seems to cause stability issues.

Thus, if you want a stable TECO (and who doesn’t want a stable editor?) you are better off getting a version of TECO-C and compiling it or installing it onto OpenVMS rather then using EDIT/TECO.

Believe it or not – I learned more about TECO before I learned about OpenVMS. And even among OpenVMS people, the TECO users must seem to be antiquarians or eccentrics! I just like the idea of programming my text editor…. (so I’m a little strange…)

Of course, vim and other more current editors are also available – and there are EDT clones for other machines if your inclination leans that way.

PS: Talking of editors – do any of you remember a text editor called NEAT? I seem to remember liking it, but I haven’t seen it since the Univac 1100/80 was decommissioned at the local university (a long time ago). And have you tried googling for a NEAT editor? (ouch!)

About TECO

This really goes back…… and is a hoot besides. Mix one part insanity, one part text editing, two parts programming language, and nine parts line noise: what do you get? Why, TECO of course! EMACS was even written in TECO!

TECO stands for the Tape Editor and COrrector, and was a text editor that basically included its own language.  In this age of full-screen color graphic displays, it can be hard to imagine what it must have been like in the days of paper tape when TECO was created (one mistake and you start over!).  The best description I found of TECO is an article by Mark Chu-Carroll in his Friday Pathological Programming Language series. He calls TECO the world’s most useful pathological programming language.

I won’t go into it too much – the documentation is surprisingly complete for a computer program of this age and obscurity. One fun thing to note is that every character is a command – not every text character, not every alphabetic character, not alphanumerics – every character is a command. Let that sink in – ^C? Abort TECO’s command sequence. ^X? Search mode flag. ^U? Kill command line….. or put a string into a specified register!

For some of us, this makes editing fun – and gives it a little edge! No screen editing here…..

Here are some sources of fun:

As an example of TECO programming, (courtesy of Mark Chu-Carroll) here is a brainfsck interpreter written in TECO!

@^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)"=^TUT8^TQPJDQT@I//QIJ@O/end/'(0A-91)
"=-.+QPA"=QI+1UZQLJMRMB\    -1J.UI'@O
/end/'(0A-93)"=-.+QPA"NQI+1UZQLJMRMC\-1J.UI'@O/end/'
!end!QI+1UI(.-Z)"=.=@^a/END/^c^c'C>

I’d like to see it work once….. There are TECO clones for MSDOS, Windows, and UNIX.

And by the way: TECO remains available to this day on OpenVMS – which operating system will celebrate its 30th anniversary on October 25th.  Mark your calendars!