TRAC (programming language)

From Wikipedia, the free encyclopedia
Paradigmgeneral-purpose macro processor
Designed byCalvin Mooers
First appeared1964
Influenced by
Macro SAP[1]
SAM76, ML/I[1]

TRAC (for Text Reckoning And Compiling) Language is a programming language developed between 1959–1964 by Calvin Mooers and first implemented on the PDP-1 in 1964 by L. Peter Deutsch.[2] It was one of three "first languages" recommended by Ted Nelson in Computer Lib. TRAC T64 was used until at least 1984, when Mooers updated it to TRAC T84.[2]

Language description[edit]

TRAC is a purely text-based language — a kind of macro language. Unlike traditional ad hoc macro languages of the time, such as those found in assemblers, TRAC is well planned, consistent, and in many senses complete. It has explicit input and output operators, unlike the typical implicit I/O at the outermost macro level, which makes it simultaneously simpler and more versatile than older macro languages.

It also differs from traditional macro languages in that TRAC numbers are strings of digits, with integer arithmetic (without specific limits on maximum values) being provided through built-in ("primitive") functions. Arguably, one aspect of its completeness is that the concept of error is limited to events like lack of file space and requesting expansion of a string longer than the interpreter's working storage; what would in many languages be described as illegal operations are dealt with in TRAC by defining a result (often a null string) for every possible combination of a function's argument strings.

TRAC is a text-processing language,[3] also called a string processing language.[4]

The emphasis on strings as strings is so strong that TRAC provides mechanisms for handling the language's own syntactic characters either in their syntactic roles or like any other character, and self-modifying code has more the feel of a natural consequence of typical TRAC programming techniques than of being a special feature.

TRAC is, like APL or LISP, an expression oriented language (in contrast to more typical procedure-oriented languages), but unlike APL, it completely lacks operators. In most respects, it is a case of pure functional programming.

TRAC is homoiconic.[5][6][7]

TRAC has in common with LISP a syntax that generally involves the presence of many levels of nested parentheses.

The main inspiration for TRAC came from three papers by Douglas McIlroy.[5][8][9][10]

Intellectual property[edit]

Mooers trademarked the name TRAC in an effort to maintain his control over the definition of the language, an unusual and pioneering action at the time. At one point, he brought an intellectual property infringement suit against DEC, alleging that a contract to deliver a mini-computer with a TRAC interpreter violated his rights. "The first issue of Dr. Dobb's Journal, one of the early publications in the personal computer field, has a vitriolic editorial against Mooers and his rapacity in trying to charge people for his computing language."[11][12] The name has since been used several times for unrelated information technology projects, including a current open source project management system called Trac.

Influence and usage[edit]

TRAC was later implemented on the PDP-8, PDP-10, and PDP-11.

There have been various languages inspired by TRAC. To avoid any trouble with Mooers, they renamed primitives and/or used different metacharacters. In SAM76's case, primitives were added, according to Claude Kagan, "because TRAC is baby talk". In MINT's case, primitives were added to give access to a sophisticated text editor machinery.

  • one perceived shortcoming of TRAC was lack of full extensibility: some TRAC primitive functions are sensitive to the distinction between a null (zero-character) argument and a nonexistent (non-delimited) one, but beyond its last non-null argument, a user-defined function cannot make the distinction. SAM76 was a TRAC-like language which eliminated that limitation.
  • Russ Nelson implemented an emacs extension language named MINT (MINT Is Not TRAC). This language is used by the FreeDOS editor FreeMACS.
  • John Walker (programmer) implemented an embeddable extension language library DIESEL [13] (Dumb Interpretively Evaluated String Expression Language) originally for menu macro processing in AutoCAD.[14]

TRAC was used by FTP Software in its PC/TCP product as the modem dialer scripting language.

TRAC was also used as a front end on Digital Productions Cray renderer for films, including The Last Starfighter.

Example program[edit]

TRAC T84 script to compute Fibonacci numbers:[15]

:(ei,<1>, 1, 0,(
:(ei,<1>, 2, 1,(
:(aa, :(ri,fibo,:(as, <1>,1)),:(ri,fibo,:(as, <1>,2)))

See also[edit]


  1. ^ a b "TRAC – A man-machine string manipulating language". HOPL: Online Historical Encyclopaedia of Programming Languages. Archived from the original on August 13, 2009.
  2. ^ a b "Coding Supply — Everything a Programmer Needs". Archived from the original on 2001-04-08.
  3. ^ David Walden. "Macro Memories, 1964–2013". 2014.
  4. ^ Carol Loeb Mir. "A Comparison of String Handling in Four Programming Languages". 1972.
  5. ^ a b Mooers, C.N.; Deutsch, L.P. (1965). "TRAC, A Text-Handling Language". Proceeding ACM '65 Proceedings of the 1965 20th national conference. pp. 229–246. doi:10.1145/800197.806048. S2CID 40013081.
  6. ^ Kay, Alan (1969). The Reactive Engine (PhD). University of Utah.
  7. ^ Klaas van Schelven. "Don't say 'Homoiconic'".
  8. ^ McIlroy, M.D., Macro Instruction Extensions of Compiler Languages. CACM 3, No. 4 (1960), 214–220.
  9. ^ Eastwood, D.E. and McIlroy, M.D., Macro Compiler Modification of SAP. Bell Telephone Laboratories Computation Center, 1959.
  10. ^ McIlroy, M.D., Using SAP Macro Instructions to Manipulate Symbolic Expressions. Bell Telephone Laboratories Computation Center (1960)
  11. ^ Mooers, Calvin (22 June 1993). "Oral history interview with Calvin N. Mooers and Charlotte D. Mooers". Charles Babbage Institute.
  12. ^ "Dr. Dobb's Journal - Vol 1". 1976.
  13. ^
  14. ^
  15. ^ TRAC information page, at The History of Computing Project, with small code sample and photo of C. M. Mooers.

External links[edit]