Have you written your own esoteric (or not) language? What did it look like?
Asked Answered
S

4

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.

Socioeconomic answered 10/2, 2010 at 20:3 Comment(1)
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.Himself
R
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.

Restrainer answered 10/2, 2010 at 20:3 Comment(4)
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.Floriaflorian
@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.Restrainer
@droog: No, it's really not C at all. Just a pathetic minimal imperative language with first-order functions.Restrainer
@Norman: That almost sounds like B; at least from what I gather. I can't find a real reference.Kester
K
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).

Kester answered 10/2, 2010 at 20:3 Comment(0)
D
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.)

Dusk answered 10/2, 2010 at 20:3 Comment(1)
Cool - do you have documentation for it, anywhere? :)Socioeconomic
A
2

The opcodes of my pythonic bacteria, of course

Ashti answered 10/2, 2010 at 20:3 Comment(1)
Funny you mention that, I had opcodes for my "Perl bacteria" (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.Socioeconomic

© 2022 - 2024 — McMap. All rights reserved.