6

I've seen a few question regarding stackoverflow users' favorite esoteric (or not) programming languages. There are also questions regarding the implementation of languages. However, I was curious to see if any of you have actually written your own programming language (be it esoteric or not) and I also wanted to know what it looks like.

I enjoy reading about and trying to learn new and inventive languages, so I thought it would be nice to see what the stackoverflow community has to offer. :)

I wrote one for fun a few years ago.

Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
  • Shame you didn't oen it up for random esoteric languages anyone has used. There aren't a lot of folks out there who have honestly implemented their own language, and most of those who have probably did it for a compilers course. – T.E.D. Feb 10 '10 at 20:27

4 Answers4

5

I have written a set of 7 "micro" languages for teaching. Each one is meant to illustrate the key ideas of one of the following full programming languages:

  • an untyped version of C
  • Scheme
  • C
  • System F
  • ML
  • Smalltalk
  • Prolog

The languages deliberately look very much one like the other, so that students see only essential differences, never gratuitous ones. I want to do two more, based on Haskell and CLU.

Sam Kamin had the original idea and helped a lot with the design.

Norman Ramsey
  • 198,648
  • 61
  • 360
  • 533
  • I don't know if untyped C would be beautiful or sacrilege. The idea appeals to the part of me that likes Scheme, but I just can't see programming in it... do you still have your implementation? I'd like to see how masochistic it is. – new123456 Sep 14 '11 at 01:15
  • @new123456: it's a toy language, of all the 7, the only one you can't usefully program in. The only supported data type is integers. – Norman Ramsey Sep 14 '11 at 03:22
  • @droog: No, it's really not C at all. Just a pathetic minimal imperative language with first-order functions. – Norman Ramsey Sep 29 '11 at 02:27
  • @Norman: That almost sounds like B; at least from what I gather. I can't find a real reference. – luser droog Sep 29 '11 at 02:57
2

The opcodes of my pythonic bacteria, of course

Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
  • Funny you mention that, I had opcodes for my "Perl bacteria" (http://vivin.net/2004/10/19/artificial-life-some-preliminary-findings) too :) I didn't go into as much detail as you have; I'd like to revisit the problem sometime in the future and make a nicer version. – Vivin Paliath Feb 11 '10 at 03:42
2

I've been working off and on on DIFL, intended as a declarative text adventure language, but becoming less declarative over time. Its main features are a very loose object system and an action system based on multimethods. (Well, its main features will be, assuming I ever finish it.)

David Thornley
  • 56,304
  • 9
  • 91
  • 158
2

One of the first languages I tried to write was a MIDI-file assembly language. You'd define tempo and instrument bank and then lots of note lines (Note-name, starting-beat-of-the-current-measure, duration, optional accent), punctuated by bar lines ("meas\n"), and dynamics (ppp,pp,p,mp,mf,f,ff,fff).

It wasn't really usable without a macro language to repeat sequences, change channels, and lay down new tracks. That required my first hash table, and a tricksy cross-your-fingers call to qsort to interleave the channels by time-sequence (implicitly carried by each Note-On/Note-Off event).

When I came back to it a year later, it had fallen victim to bit-rot. After no small struggle I rediscovered that the sort-and-output-everything function was triggered by an explicit EOF code. A macro-expanded song was easily 20,000 lines with that crucial EOF line having, therefore, 1/20000th of a chance to be spotted when trying to figure out just what in the heck is going wrong!

I am somewhat pleased that all the evidence is safely tucked away in a dead CPU underneath the microwave cart. The horrors!!

Edit: Upon further reflection there are some interesting things about the MIDI format. It has a variable-length integer type (IIRC using the sign bit to signal the last byte). It's byte-oriented, being designed to run over 9 parallel wires; and it has some crazy time-synchronization thing I never understood. But all I cared about was that the Windows95 media player could interpret the output (it could even use the 8bit General MIDI tone bank built into the sound card; the cymbals were gloriously distorted).

luser droog
  • 18,988
  • 3
  • 53
  • 105