(2023-08-05) Saving the oldest embedded scripting language from extinction
--------------------------------------------------------------------------
I have started some work that almost no one in the world is probably going to
appreciate: reviving a programming or, should I say, scripting language that
got first developed from 1960 to 1964, then got a major revamp in 1984, then
was supposed to get another revamp in 2001 but instead fully died out around
2005, and all the info on this language can now only be found on the
Internet Archive. And yes, I am basing my work on the very first version of
this language from 1964. Those select few who knew it are mostly very old
now, if alive at all. I think it's safe to say there are less than 100
people left on the planet who know how to write scripts in this particular
version of this particular language, and less than 1000 people who know any
existing dialects of it at all. Yet I still hold my ambitious hopes to
change this status quo and to help this language reach the popularity it
really deserves.

The language is called TRAC (short for "Text Reckoning And Compiling", sic).
Yes, it is almost 60 years old by now, yet I heard nothing about it until,
like, July 2023, when I, having started developing my nne editor, also
researched various MicroEMACS clones (like mg) and stumbled upon the mention
of a DOS-based editor called Freemacs, which is small indeed (~21k in size,
as they say), but other than that, the only worthy detail about it was that
it is scriptable in a language called MINT (which is a recursive acronym,
"MINT is not TRAC"). When I started digging deeper into the topic of TRAC
itself, it turned out to be nothing like I had seen before. And I had seen a
lot: various Lisps and Forths, Rebol/Red, Tcl, even implemented my own VTL-2
flavour and ran a Brainfuck interpreter in it, but this... This was
something else, something way ahead of its time, something designed from the
perspective of linguistics and actual human-machine interaction, not
computer science or mathematics, and yet remained so simple at its core that
the entire parser algorithm is explained in the spec itself in 15 rules, and
this algorithm essentially allows anyone to implement a call stack with
unlimited recursion level with absolutely no memory or processing overhead.
Yes, it does rely on your ability to insert arbitrary amount of characters
in the middle of the string or to delete them from the string, so it's not
so trivial if your system doesn't have basic malloc/realloc capabilities,
but other than that, the language is *extremely* lightweight for what it's
capable of. And, unlike e.g. Lisp or Forth, it doesn't enforce you to create
or emulate any special data structure beside the simplest lookup tables for
primitive functions and "forms", which are just named strings that can hold
variable data as well as other code: yes, TRAC is fully homoiconic and
functional.

After seeing all this, my first natural questions were: why isn't TRAC still
popular nowadays, especially in embedded sector which is mainly scripted in
Lua, various Forths, BASICs and even JS? Why didn't they finish the T2001
standard? Why did the TRAC Foundation website go down in 2005? Well, the
original TRAC creator, Calvin Mooers, tried to control its redistribution
until his very death in December 1994, and he even trademarked the TRAC name
itself and tried to sue people for cloning it (after specifying full
algorithms in his papers, aha). This is why, despite several clones had been
developed (like SAM76 or the aforementioned MINT), the original language
didn't gain enough TRACtion because of such a vigorous copytardism of the
author (and this is why MINT was probably based upon the T-64 standard when
the T-84 version already came out). After Mooers' death, the control over
TRAC was taken by his daughters: Helen Sophia Mooers Solorzano and Edith
Augusta Mooers. They eventually founded the TRAC Foundation, published all
the specs they could find and open-sourced the T-84 version under GPLv1. But
it looks like it was too late to recover from their father's mistake, and no
one was really interested in this language anymore. And the development of
T2001 was started in... Java and got frozen at the pre-alpha stage. Four
years later, the website went down. Only the IA remembers.

Gotta admit, the more I read about the history of this language and the folks
around it, the more it gave me shivers. And then, here comes The Man. Ted
Nelson himself. With a very bizarre video I'm even gonna link here ([1]). In
this video, he explains how he participated in the creation of an
unauthorized TRAC clone which would eventually become SAM76 by the
R.E.S.I.S.T.O.R.S. group, and also mentions a fairly recent recreation of
the original T-64 specification in Python (v2) by Nat Kuhn from the same
group (his son Ben Kuhn also took part in it). I thought, "well, this is
something but definitely not enough". Indeed, I can't even imagine how an
implementation in a high-level (and not very resource-frugal) language would
be of any use in this case, aside from some modeling or prototyping. So, I
decided to start creating my own implementation in ANSI C, again, just like
with nne, aiming it at sub-1000 SLOC and maximum portability. This
implementation is going to be called nntrac (all lowercase) and is mostly
being written in accordance to the original T-64 specification, aside from
several differences I'm going to specify in the docs and in my next
TRAC-related post when the first full version of nntrac is ready. For now, I
can just say that I plan on implementing a fully embeddable API (simpler
than Lua's one), ability to write custom primitives and an extended set of
built-in primitives in addition to the 34 of them that belong to the spec.
And all this under 1000 SLOC of C.

Now, after I finish nntrac and put it into a repo, what am I going to do with
it next? Well, I have in mind a bigger project of my own featurephone UI
shell, and I want the apps for this shell to be fully text-based scripts.
TRAC in general and nntrac in particular are going to ideally suit such an
embedded and low-powered environment with a custom set of graphics and input
handling primitives I'm going to specifically add for this phone UI. Of
course, there is a lot more work to do regarding documenting all these
things, and I don't mean just my custom APIs and primitives, I mean the
entire language itself. All current TRAC manuals exist in a form that's not
very comprehensible by today's programmers. They need to be refined and
properly structured. For nntrac and its future usage perspective, this is
going to be a big deal and probably will take just as much time as the
creation of the interpreter itself.

Oh, and did I also mention that nntrac, along with all its documentation, is
going to be released into public domain? Because just like SQLite and nne,
public domain deserves a decent lightweight scripting language with no
nonsense included. This 60-year-old treasure must not be forgotten and
surely can serve for the greater good many many years forward if taken care
of. Looks like I'm the one who has to do it.

TRAC must live.
NET must die.

--- Luxferre ---

[1]: https://www.youtube.com/watch?v=wFiHE2NVQOY