TL;DR Clicking on this link and then and then on the “play” triangle will open a terminal running Trac!

I started programming in 1968, as part of a group called the RESISTORS. We met in a Barn in Pennington, NJ, under the tutelage of man named Claude Kagan, who worked at the Western Electric Research Center (part of “Ma Bell” at the time). A lot of what we did had to do with the Trac language, something of a “toy language” by today’s standards.

Claude died in 2012, around the time I learned Python, and apparently that is what got me to write a full-fledged “Trac processor” [interpreter]. I wrote a blog post about some of the history, and the experience of writing the program.

I put it in a Github repository, which has garnered 4 stars over the years. (That does not mean it’s great, that means 4 people “liked” it.) To run it you needed to download or clone the repository, and download Python or already have it. Not very user-friendly. I occasionally wondered about getting someone to host it on line.

Fast forward to 2020, and in cleaning up these pages, it occurred to me that there must be an easy way to host it with one of the free on-line IDEs, and indeed that turned out to be the case, at repl.it. Click here, and then on the “play” triangle to start it; this is the same link as up top.

Trac is a little different from most other languages in several ways. The first one you need to know about is you terminate input, not with <enter> but with a “meta” character, which by default is the apostrophe (').

If you type #(ml,300,500)', you will see the product printed back at you.

Trac is essentially a macro-expander, so recursion is big. If you type #(fb,fact.trac)' you will retrieve a script to compute factorials. #(fact,5)' will return 120, which is 5 factorial. Trac uses arbitrary-precision string arithmetic, so #(fact,100) will not faze it. #(fact,1000) will exceed the default Python recursion depth, but you could probably find a way to increase it if you really wanted to.

One of Claude’s favorite scripts solved the “Towers of Hanoi” puzzle. Enter #(fb,tower.trac)' and then, following Claude, you can enter #(tower,3,Hanoi,Haiphong,Saigon)'. You can print out the script by entering #(pf,tower)'.

We did this all on a teletype, so this version has some features we would have been very happy to have, starting with a functioning backspace key. Left and right arrows move the cursor, and you can insert and delete characters right in the middle of what you typed. Shift-left-arrow and shift-right-arrow go to the beginning and end of the input string; the latter is especially helpful because if you type the “meta” character in the middle it will truncate your input. Even better, option- (or alt-) followed by an arrow key lets you scroll through and re-use or re-edit previous input, Bash-style. When you enter a close-paren, the cursor briefly flashes to the matching open-paren. That would have been very helpful way back when!

There are a couple more stored scripts: fib.trac has a script to compute the n-th Fibonacci number; exp.trac computes #(exp,a,b) in log(b) time. edit.trac has the example from the Github README file.

If you get inspired to learn a bit more about the language, there are some links in the README.