Note: This post is largely based on an old page from the main site that makes more sense here, now that the blog is finally up and running.
Early on in my career, I found programming language design and compiler/interpreter construction fascinating enough to tinker with on a regular basis. So, I created a handful of languages that try to prove some point or other or have what I thought were interesting quirks. Most of them are absolutely not meant to be used industrially and the implementations almost certainly aren’t up to the task if you try.
…ships in bottles, minus the glue fumes and tweezers.
It’s probably best to think of work along these lines sort of like ships in bottles, minus the glue fumes and tweezers. The languages rarely serve an engineering purpose of their own, but are an interesting diversion, and usually make a good closed project.
A lot of these are much older projects, worked on “in the public eye” on a long-defunct mailing list for programming languages that were peculiar in some way. At the time, I released all the code into the public domain with a request that people using it in interesting ways contact me. More recently, in pushing things to GitHub, I’ve since had a change of heart and licensed the current versions under the GPLv3, feeling that I would much rather see changes to things released to the public rather than someone finding a use for it and keeping everything under lock and key.
I mean, not to rant, but it’s the twenty-first century. If your money-making scheme requires secrecy (and the business isn’t about keeping secrets), it’s probably not a very good scheme, especially when it comes to code…
(That said, if you want the versions released to the public domain, they’re not so hard to find, just not linked here.)
…only operation is rule-based replacement.
There’s a decent chance that, if you recognize my name and haven’t ever interacted with me directly, this is why you know me. Thue (pronounced TOO-ay after Axel Thue) has its own Wikipedia page for being (as far as I can tell) the only programming language whose only operation is rule-based replacement, in this case based on semi-Thue (also known as Chomsky-0 or unrestricted) grammars.
You can grab the source to Thue and give it a try.
_0::=_ 1_::=1++ 0_::=0++ 0++::=1 01++::=10 11++::=1++0 _1++::=10 __::=_//_ //::=::: ::= __
I may revisit Thue in the future, because it doesn’t quite seem complete, for some reason. While I think it’s still technically possible to do so through extensive sets of rules, the ability to snag sections of text out of their context and reuse them in replacements (something like a variable) might give the language more usability.
With a name that seems more annoying every time I look at it, Das Klickenklacker also won me a small amount of renown in some circles. It was an attempt to take the two-dimensional Rube programming language, at the suggestion of creator Chris Pressey, and make the rules feel more predictable.
I , , ) F ========M============================ , , (a M ===========:=== 1 M >>>>>>>>>>>> : F - M = , M , ( =====================:== >>>>>>>>>>>>>>>>>>>>>> , , ) 000a7d63657c74646f2002 F =N= F , :::::::::::::::::::::: , ) =================================W= C F F = >
I’m not convinced that it was successful, but I’ve had students at least claim it was fun to work with, sometimes even when their grades weren’t in the balance, so I hereby declare victory.
Plus, the animations can be fun to watch. The implementation finally uses the ncurses library, too. So, this is another case that I (or an enterprising collaborator, if anybody feels the urge) might want to revisit the implementation in order to change the colors of objects as they stay in one place for longer periods of time.
This is the last of the things you may have heard of, if you’re here for the programming languages rather than to read my ramblings. Wierd (WHY-urd as in “wired”) was an attempt, with some collaboration, to create a language that combined the interesting features of Befunge and Brainf— with a minor new gimmick.
Wierd, then, runs a minimal stack-based virtual machine based on a two-dimensional program, but the “important” parts of the program are the angles between visible characters, not the characters themselves. So, in a very loose sense, there are no instructions, certainly none that get explicitly put into the program.
The language runs ASCII art “wires” that intersect at angles which, themselves, are meaningful. The angles translate into very simple instructions, which then execute. It turns out to be fairly horrific to program in, partly because the interpreter isn’t entirely complete, but mostly because overlooking an instruction generally requires a complete rewrite to lay everything out on the screen.
* ***************** * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * *************** * * * * * * * * * * * * * ********** * * * * * *********** * * * * * * * * * * * ** * * * ****** * ** * * * * ** * * * * ** * *** ** * ** * * * * * * * * * * * * * * * * * **** ***** * * ** * * ****
On the bright side, Wierd might be one of the very few programming languages that require no literacy. In fact, a visual editor that allowed for easy revision could make this a useful tool, though the minimalist instruction could still be annoying. (At one point, I prototyped a system that would take a list of stack-based instructions and rough out what the program needed to look like, trading literacy back for ease of use.)
This is another project that could probably use some attention. There was an old bug report that the jumps didn’t quite work. I was never quite able to understand what the user was trying to get at (because the alleged bug was wrapped with an argument that example code wasn’t exactly what the user wanted as an example), so it’s still out there, as far as I know.
An unreleased project for my programming languages course to limit the number of languages I assigned for students to superficially learn, I developed an interpreter for a language reminiscent of the versions of BASIC often used by 8-bit home computers, Commodore BASIC in particular.
While it lacks anything like strings or data types other than real numbers (IEEE floating-point, not Commodore), functions, direct memory access (
POKE), and so forth, the interpreter does have the ability to alter the behavior of expressions and activate and deactivate a wide variety of flow control statements, including many that are not found in any major programming languages. There’s also a
TRACE facility to see which lines are executed.
0 FOR index = 1 TO 10 10 LET x = 1 20 LET x = x * 2 30 LET x = x * 3 40 LET x = x * 4 50 LET x = x * 5 60 LET x = x * 6 70 LET x = x * 7 80 LET x = x * 8 90 LET x = x * 9 100 LET x = x * 10 110 COME FROM 10 * index 120 PRINT x 130 NEXT index 140 INPUT y 150 GOTO 160 + (y < 0) * 10 160 END 170 PRINT y 180 REVERSE 190 REM Lines 0-130 loop, with COME FROM truncating the loop length 200 REM line 150 jumps to 170 if the input is negative, 210 REM print the input, reverse direction, print again, and end
Some time soon, I’ll release it and/or add at least some of the missing features.
This was intended as sort of my magnum opus and was, surprisingly, mentioned on my Wikipedia page when it still existed. Unlike the other languages focused on some minimalist aesthetic, *W would have been my answer to INTERCAL on the humor side and old-style C++ on the complexity side.
I think the specification is feasible (if not very funny), but it definitely lacks in genuine complexity and I never got around to an implementation. Still, it stands as one of the very few “esoteric languages” that could be more than a toy.
It has quirky commenting syntax, compound statements, data types, subroutines, conditions, a rich set of operations (yes, including a unary prefix
* operator), and so forth. Maybe one day, I’ll link the original specification here. To my knowledge, though, the language has never been implemented.
I don’t recall if I ever released this before (the complete lack of documentation suggests that I haven’t), but it’s a quick and dirty interpreter for the Post-Turing Machine, a simple computational representation developed by Emil Post that is often considered a special form Alan Turing’s a-Machine or the Turing Machine.
[T] Right If 0 Goto Z Print 0 [G] Right If 1 Goto G [H] Right If 1 Goto H Print 1 Right Print 1 [L] Left If 1 Goto L Left [M] Left If 1 Goto M If 0 Goto T [Z] Right
…fairly nice model and syntax…
The language has a fairly nice model and syntax, not to mention one of my favorite language names, I think, but the code is pretty terrible, particularly the extremely lazy parser. There’s a fairly good chance I threw together a prototype to try it out and forget about it before the release I planned at the time.
Prim (a.k.a. RTL)
This is a language trying to codify the idea of μ-recursive functions—partial functions taking a tuple of natural numbers to return a natural number—as a programming system, specifically using the Primitive Recursive functions (the smallest complete set). Incomplete, the language should include the ideas of constant (0), successor-ship, projection, composition, and primitive recursion.
Z() -> zero. S ( S ( zero ) )-> two. S(zero )->one. S( two) ->three. S(S(S(Z())))->num. .three?. two ? . one? . zero ?.. P:4;num(zero, one, two, three)->result. num?. result?.
What can I say? I enjoyed my Theory of Computation classes.
The package includes both a Prim interpreter and a compiler from Prim to Sphinx C- -, a high-level (C-like) freeware assembler for x86 processors that I thought was a great idea at the time, but is now non-trivial (though still possible) to find.
Turing Machine Assembler
Years ago, Turing Machines were basically an academic concept that hobbyists talked a lot about. It bothered me that, for all the talk, I hadn’t actually worked with one. So, I implemented the system.
; Sample Turing Machine program to invert a tape and print the new Zeros 23 / `1 : 23 / `0 R . ; Make 1s into 0s (and print) 23 / `0 : 23 / `1 R ; and make 0s into 1s (but don't print)
This package contains a compiler that translates a Turing program (that is, the specification of a Turing Machine) into bytecode that can be run on the linked emulator. It wouldn’t surprise me if I had visions of Java-like browser plug-ins running Turing across the Internet. That sounds like me at that age. And I did find a first pass on de-obfuscating the emulator code.
Finally, something that might actually be useful to somebody!
My Master’s Thesis was meant to dovetail with a long-term PhD candidate who was a local hardware designer, a way to “rough out” a processor using the tools available to high-level languages, which didn’t really exist cheaply at the time for hardware.
Quick history: Since the campus was built on the cornerstone of our local military contracting industry, the department was still mourning the loss of Pascal as the official introductory programming language, and Ada was completely specified in formal ways, we decided that I should start with an Ada-to-VHDL compiler, obviously only supporting a small subset of Ada. The plan was to make this part of a suite of software-to-hardware tools developed via other students’ theses, but that collapsed shortly after I graduated for a variety of reasons. The result is what I now call SiliconAda.
That said, I have released the version I found. I don’t believe it’s quite the final version, because my thesis contains example generated VHDL output and this version of SiliconAda doesn’t seem to produce it given the inputs. But it should be very close and probably just needs a little bit of attention, because I can’t tell the difference on a visual inspection from the code listing I published.
…focus more on the graph transformations, dependency checking, and the push for parallelism.
If I had to go through the thesis process again (perish the thought!), in hindsight, I would probably want to focus much more on the graph transformations, dependency checking, and the push for parallelism. I wrote that code because it seemed like it was necessary for the concept and obvious how to make it work, but I have since discovered that it was (and maybe still is) a fairly novel idea. It also would have made more sense for the overall project to have one thesis that focuses on a central algorithm that the next thesis in the chain could have used for something closer to the overall compiler, rather than the thesis mostly being “I wrote a compiler” and leaving it at that.
Something else I would have liked to have looked at was circuit layout. It would have been great to put in a program and get even a lousy circuit diagram. As mentioned, though, that surely would have gotten farmed out to another student later, had the original plan remained in place.
Incidentally, I also found the thesis itself in some ancient WordPerfect format. If anybody really wants a copy, I could probably be convinced to release it under a Creative Commons license and may eventually post it somewhere.