Text Executive Programming Language
In 1979, Honeywell Information Systems announced a new programming language for their time-sharing service named TEX, an acronym for the Text Executive text processing system. TEX was a first generation scripting language, developed around the time of AWK and used by Honeywell initially as an in-house system test automation tool. TEX extended the Honeywell Time-Sharing service (TSS) line editor with programmable capabilities which allowed the user greater latitude in developing ease-of-use editing extensions as well as write scripts to automate many other time-sharing tasks formerly done by more complex TSS  FORTRAN programs. Overview. TEX was a subsystem of Honeywell TSS. Users would enter the TSS command 'tex' to change to a TEX session mode of operation. TEX expressions could be entered directly on the command line or run from script file via the TEX command CALL . TEX programs are a collection of TSS line editing commands, TSS session commands and TEX statements. TEX variables could be inserted into TSS commands and TSS line editor commands via the TEX variable substitution feature. TEX programs were primarily designed to extend the line editor system. Consequently, TEX had no concept of file input /output relying instead on applying line edit commands to the working file and saving as needed. The key developers of TEX at Honeywell were Eric Clamons and Richard Keys with Robert Bemer, famous as the father of ASCII and grandfather of COBOL, acting in an advisory capacity. TEX should not be confused with TeX a typesetting markup language invented by Donald Knuth. The American Mathematical Society has also claimed a trademark for TeX, which was rejected, because at the time this was tried (early 1980s), "TEX" (all caps) was registered by Honeywell for the "Text EXecutive" text processing system. Variables . All variables were stored as strings and converted to integer numeric values when required. Floating point variables, arrays or other datatypes common in current scripting languages did not exist in a TEX environment. All variables were stored in a single global variable pool which users had to manage in order to avoid variable naming conflicts. There were no variable scoping capabilities in TEX. Variable names were limited to 40 characters. TEX provided several internal read-only registers called star functions or star variables which changed state when certain TEX string parsing operations were executed. Star functions provided a means to  get the current date and time, resultant strings from a split or scan string parsing operations, TEX internal call level and TSS session information. The maximum length of a string value was 240 ASCII characters. This includes intermediate results when evaluating a TEX expression. Numeric string values are limited to 62 digits in the string including the (-) for negative numbers. Numeric values are also normalized where leading zeros are stripped from the string representation. Some examples of variable usage: Operators. TEX has three types of operators: When constructing a TEX expression, all spaces must be compressed out except for string  literals. In general,spaces delimit TEX statements. Arithmetic. TEX supports only basic integer arithmetic operations: with up to 16 levels of parentheses. Some examples are: Boolean operators. TEX boolean operators come in two flavors for: They were most often used within the context of an IF control statement. A list of available numeric boolean operators in TEX are: A list of available string boolean operators are: String boolean operators are affected by the TEX CASE mode. Under CASE mode, strings such as 'ABC' and 'abc' were considered equal (TEX converted 'ABC' to 'abc' prior to the comparison). Under NOCASE mode , the 'abc' string would be considered greater than the 'ABC' string based on the ASCII code point value for 'a' being a larger value than the 'A' ASCII code point value. The boolean NOT operator was represented by the circumflex character (^). Some examples of boolean operators in action: TEX did not provide and or or connecters to make more complex boolean expressions. Instead, programmers had to use nested if statements for and connections and a block of if...do something statements to handle or connections: String operators. String concatenation in TEX was provided by the comma operator: TEX provided  several string splitting operators: Some string splitting examples: TEX provided several string scanning/parsing operators: Some string scanning/parsing examples: Labels. All TEX statement labels were prefixed with a (!). Statement labels were in general ignored unless referenced by a goto or call statement. One notable feature of TEX was the ability to call or goto labels in other files. Coupled with the TEX SUBS mode meant that TEX could create new scripts via line editing, save and then call or goto labels in these scripts dynamically. The mypgm file: Calling by label example: In the above example, TEX would process  the /mycat/mypgm file searching for the !hello label(*). TEX would continue processing the file until a return statement or exit statement was executed or end of file was reached. Goto by label example: In the next example, TEX would process the /mycat/mypgm file searching for the !hello2 label(*). TEX would continue processing until an exit statement or end of file was reached. An error would be thrown if a return statement was executed and there were no CALLs active. (*) TEX did not check for duplicate labels in the same file, consequently execution was unpredictable if present. Substitutions. TEX  provides the SUBS and NOSUBS commands to activate or deactivate variable substitution for subsequent TEX statements or TSS commands. In the above example, the xx variable contains a TEX output statement as its value. The subs command specifies that (?) is the substitution character for all future statements of the program. Upon processing the first ?xx? line, TEX will substitute in the out:"Hello World" command for ?xx? and then execute the resultant statement. The nosubs command turns off substitutions for subsequent statements and so TEX issues an error when it tries to execute the second ?xx? line. Indirections. In addition to  variable substitution, TEX supported variable indirection. Variables prefixed with the underscore character (_) were considered to contain a variable name as their contents and so TEX would use indirection to get the value. TEX limited indirection to 64 levels to avoid possible looping. As an example: Input/output. Honeywell Timesharing sessions had a concept of the working file. To edit an existing file, you would first make it the working file via the old command. To create a new file, you would first create it via the new command. Once changes were complete, you would either save (for new files) or  resave the working file. Basically only one file could be open for editing at a time. TEX programs were primarily designed to extend the line editor system. Consequently, TEX had no concept of file input/output relying instead on making changes to the working file via line edit commands and saving as needed. However, TEX did provide terminal-oriented input/output commands: A simple example using in and out: Star variables and functions. TEX provided star variables as a means to access results or side-effects of TEX system functions or to represent ASCII terminal codes. A list of star  variables follows: Terminal codes. Terminal codes were mapped into star functions for easy reference in TEX programs. Commands. TEX was built on top of the TSS line editor, as such line editor commands could be used within a TEX program. TEX programs may have: Edit commands. The general command format was: The could contain a range as in F:/hello/,/world/ to find all lines that start with the string "hello" and contain the string "world" too. TEX provided standard line-based file editing commands: Each command could be modified with a numeric repeat value or with an asterisk (*): Commands can be  further modified with a line matching string or expression: For string mode, an S was added. Whenever /xxx/ was found within the line then the edit was applied: Lastly, the commands can be further modified with V to turn on verify mode and with O to specify nth occurrence string mode: There are a few other lesser used editing commands: In all edit command formats, the /xxx/ or /yyy/ or 999 could be replaced with a TEX variable. In addition, the 999 value could be replaced with an asterisk (*) to denote all occurrences. TEX commands. TEX did not provide commands  for numeric or conditional looping or switch cases as is common in modern scripting languages. These had to be constructed using if, labels and goto commands. As an example, to eliminate duplicate lines from a file, one would use: TEX commands: TEX modes. TEX modes defined how other TEX commands would operate. The *svmd variable contained the current state of all TEX modes in the form of TEX commands to restore the modes. Each mode had an inverse command to turn the mode off which could be done at any time. TSS commands. While beyond the scope of this article , the most commonly used TSS commands were: Example code. This code was excerpted from a TEX based Adventure game written by a team of Explorer Scouts from GE Post 635, Schenectady New York circa 1980. The Adventure game was the first of several popular online text-based adventure games available on the GE Timesharing service. The scouts decided to create their own adventure game using TEX. The original Adventure game used two word commands to navigate Colossal Cave. The parser shown below handled simple two word commands like go west or move right and converted them into x,y deltas  for positioning and directional orientation in the game. Parsing the Adventure two word commands: Rolling dice: Televideo screen codes: Notable features. The most notable feature in TEX was its SUBS mode allowing variable values to crossover and become executable code. It allowed a programmer to create new variables on the fly to be used in later TEX expressions in a LISP-like fashion. TEX also allowed programmers to create scripts on the fly via line editing, saving the content to file later to be executed as part of the current program using interfile call and goto statements. However, in most  cases, these features were used to provide simple dynamic goto statements in code as seen in the Adventure game parser example. What other kinds of Artificial Intelligence constructs could be developed were never fully explored. An example of creating variables on the fly and then using them to do an interfile goto. The TEX program above illustrates dynamic script creation and then execution via substitution, file editing and interfile gotos. In effect, programs writing programs were possible although seldom done. In the above example, the mycat/mypgm_1_2 file would be executed at label_3 printing out "hello world". Text Executive Programming