Pathological Programming in a Circular Queue

Today, I’m going to show you a very simple, very goofy little language called “SCEQL”, which standards for “slow and clean esoteric queue language”. It’s based on nothing but a circular queue
of numbers with nothing but 8 commands. It’s not one of the more exciting languages, but it can
be a lot of fun to figure out how to make the circular queue do what you want it to.

In SCEQL, you’ve got a circular queue of bytes. You can’t *ever* remove anything from the queue. You can alter values on the queue; move things from the front to the back; and add things to it. But that’s it.

The commands are:

Instruction Description
= Rotate the byte at the front of the queue to the back of the queue
- Decrement the byte at the front of the queue.
_ Increment the byte at the front of the queue.
Loop: if the byte at the front of the queue is not zero,
continue executing at the next instructions; otherwise, jump to
the instruction after the matching “/“. Roughly
equivalent to BrainFuck “[“.
/ End loop: branch back to the matching "/". Roughly equivalent
to BrainFuck "]".

! Grow queue: append a new zero byte to the end of the queue.
& Input a byte, and append it to the end of the queue.
* Output the byte at the front of the queue, and then
append it to the end of the queue.

So, how would we write "Hello world"? Not too hard, actually. We need to know the
ascii values of the characters. In bytes in ASCII/UTF-8 encoding, "Hello world" is the
sequence of bytes: [72,101,108,108,111,32,87,111,114,108,100,10].
So, we need to have a total of 12 bytes on the queue. It starts with one 0, so we need to add 11. Then we need to generate each of those numbers.

!!!!!!!!!!!
________________________________________________________________________=
_____________________________________________________________________________________________________=
____________________________________________________________________________________________________________=
____________________________________________________________________________________________________________=
_______________________________________________________________________________________________________________=
________________________________=
_______________________________________________________________________________________=
_______________________________________________________________________________________________________________=
__________________________________________________________________________________________________________________=
____________________________________________________________________________________________________________=
____________________________________________________________________________________________________=
__________=
*
*
*
*
*
*
*
*
*
*
*
*

Neat, huh? How about something slightly less trivial? Input two numbers and add them together? It's surprisingly hard in SCEQL, because the input and output is all done in bytes. So printing numbers isn't particularly easy. In fact, it's a royal pain. So, of course, the
solution is: cheat!. I added two new instructions: "<" to read a number from
the input, and ">" to print a number to the output. (You can grab the interpreter extended with those two instructions here. With those extensions, a program
to input two integers, add them together, and print them out is:

<<==_==-/=>

That is, input two numbers, and add them to the end of the queue. Circle past the zero that
was the initial value on the queue. If the first of the two numbers isn't zero, then rotate the queue to the second number, increment it, rotate back to the first and decrement it, and branch
back to beginning of the loop. After ending the loop, rotate to the second number (the result),
and print it out.

Just for kicks, here's a long program in SCECL: "99 bottles of beer".


"99 bottles of beer" song in Sceql.
Written by Keymaker.
Uses UNIX nl (dec 10) in output.
_________!=_________!!===_=!===\-/==-==_=_==/==-===_==/=____
____________________________________________*====-//===________
________________________________________*====-------------------
-----------------------------======_____________________________
___*====________________________________________________________
__________*====_____________*====_____*====*====--------*====---
----*====-/======_==-==_=--==/==-===_==/====-=_=-===/=-====
_=/=\-/________________________________________________________
___________________________________________________________*====
-//====________________________________*====___________________
____________________________________________________________*===
=---------*====-/________________________________*====_________
_________________________________________________________*====__
_*====*====_____________*====-/________________________________
*====___________________________________________________________
____________________*====-*====-/______________________________
__*====_________________________________________________________
___________________________*====------------*====---*====-/____
____________________________*====_______________________________
________________________________________________________*====---
-------------------*====___________*====*====-/________________
____________________________*====------------*====-/===-==_=_=
=/==-===_==/=________________________________________________*
====-//===________________________________________________*====
------------------------------------------------======__________
______________________*====_____________________________________
_____________________________*====_____________*====_____*====*=
===--------*====-------*====-/======_==-==_=--==/==-===_==/==
==-=_=-===/=-====_=/=\-/_____________________________________
________________________________________________________________
______________*====-//====________________________________*====
________________________________________________________________
_______________*====---------*====-/___________________________
_____*====______________________________________________________
____________*====___*====*====_____________*====-/_____________
_________________________________*====-/__________*====________
________________________________________________________________
__*====_____________*====__________*====------*====-/__________
______________________*====_____________________________________
__________________________________________*====-*====---------*=
===-/________________________________*====_____________________
_______________________________________________*====___________*
====________*====---------*====-/______________________________
__*====_________________________________________________________
________*====_____________*====----------*====-/_______________
_________________*====__________________________________________
______________________________________*====---------------*====_
_________________*====*====-/________________________________*=
===_____________________________________________________________
____________*====___________*====-/____________________________
____*====_______________________________________________________
__________*====_________________*====---*====______*====-------*
====----------*====-/__________________________________________
__*====------------*====-/====-=_=_===/==-===_==/=_===\-/==-
==-=/==-=-==_=_==/===-==_===/====\-/===-=_________=/==/=====
_=-==_=_==/==-===_==/====-=_=_===/=-====_=/=\-/=-=-==_=_==
/==-===_==/=________________________________________________*=
===-//===________________________________________________*====-
-----------------------------------------------==/=____________
________________________________________________________________
_________________________________*====_*====-/_________________
_______________*====____________________________________________
_________________________________*====__*====___*====-----------
--*====-//===________________________________*====_____________
_____________________________________________________*====______
_______*====_____*====*====--------*====-------*====-/======_==
-==_=--==/==-===_==/====-=_=-===/=-====_=/=\-/_____________
________________________________________________________________
______________________________________*====-//====_____________
___________________*====________________________________________
_______________________________________*====---------*====-/___
_____________________________*====______________________________
____________________________________*====___*====*====__________
___*====-/________________________________*====________________
_______________________________________________________________*
====-*====-/________________________________*====______________
________________________________________________________________
______*====------------*====---*====-/_________________________
_______*====____________________________________________________
___________________________________*====----------------------*=
===___________*====*====-/_____________________________________
_________*====-/__________*====*====-/===-==_=_==/==-===_==/
====-==_=_==/===-==_===/====/

0 thoughts on “Pathological Programming in a Circular Queue

  1. Ithika

    Egads! You see, I imagine this is what most people reckon programmers do all the time… it certainly bears as much relation to “real” programming as whatever goes on in the ‘Hackers’ or ‘Swordfish’ movies.

    Reply
  2. Stephen

    And one supposes that a Turing machine can be written in this language.
    One does not suppose that and obfuscated SCEQL contest is needed.
    I think my modem (which is on a very noisy phone line) spit out that ’99 bottles of beer’ example. Or something very much like it. Maybe it was ’12 days of Christmas’.

    Reply
  3. Brian Thompson

    I actually wrote a very similar language spec called Ouroboros. Its since been taken down from the original server, but I’ll try to repost it to the esolang wiki and update it. I never implemented it, however, and merely used it as proof-of-concept for my other pet project at the time, Glypho. Looks messy. I love it!

    Reply

Leave a Reply to Ithika Cancel reply