Even since I heard about it, I’ve been fond of the Rockstar programming language. Or, more precisely, I’ve been fond of the humor behind this langage, and the fact Rockstar it is basically a joke pushed to eleven, with actual implementations and potentially actual programs to be written.

Last year, I tried to do the Advent of Code using Rockstar, but immediately hit a roadblock. This year, I decided to push through and accidentally committed to do so by @ing by Jeff Atwood. Unfortunately, this proved to be a commitment I could not hold to, and I’ve decided to quit after solving the first challenge (which took me several days to do). However, this was a learning experience; let me share it with you.

Down

As a long-time Ruby developer, I easily forget how good I have things. Ruby is a high-level language optimized for developer happiness, after all. Rockstar is certainly Turing-complete, but also very bare-bones. No objects. No regular expressions. No iterators. No data structure but arrays. If you want anything more than loops and variables, you’ll have to build it yourself. In a way, it felt like programming in Assembly, or playing survival Minecraft. You want an enchanting table? Start punching trees.

Of course, like with Minecraft, this is part of the game, but I wasn’t prepared for the time it takes to do anything. I eventually started writing a library of functions, and in retrospect I should have done that from the start. Go over my strategy, identify the tools I’ll need, and create them. Instead, I spent too much time stumbling my way procedurally.

Cryptic Writings

What makes Rockstar great are the poetic literals: ways to assign constants, strings or integers to variables using plain English. My love is true assigns the constant true to the variable my love; Your mind is thinking madness assign the value 87 to the variable your mind; Daddy says she's too young but she's old enough for me assigns the value she's too young but she's old enough for me to the variable Daddy.

This is clever and fun, and I was expecting to spend most of my time searching for thematic literals, instead of finding my way through my own code. I failed to anticipate how quickly code can be obfuscated. This is especially true when you need to assign values like 0 or 1, for which you need to use 10- and 11-letter words – at a glance, it’s hard to tell how many letters a long word has.

Compounding this is the fact that poetic literals can only be used in variable assignments. So if you need a scalar value in an operation – say, to evaluate the exit condition of a loop – you need to first go through a variable, and then use it in the operation. All this boilerplate takes a lot of headspace very fast.

Once again, this is completely fair given the purpose of Rockstar, but it makes for a harder challenge than I was expecting. I eventually came up with techniques to make the code easier to decrypt, such as using words starting in i, j or k for loop counters (The idol is disharmony for i = 0), or pre-assigning “constants” for recurring values like 0. But even then, reading my own Rockstar was really hard. In the end, I resorted to commenting every line with pseudo-code, which is not very rock’n roll.

Achtung Baby

Adding these comments led me to a bug in Rockstar, or at least in Sinatra’s implementation (when assigning a literal string, comments put at the end of the line are considered part of the string). But, in truth, this was only one among many, though some are certainly more unfortunate consequences of the language’s design that actual implementation issues.

For example, you cannot re-assign a new, empty array to a variable. Because the same keyword, rock, is used to create a new array or wrap an exiting variable into a new array, using it several times with the same variable name – in a loop, for example – only re-uses the array created the first time.

By the same token, you can only get the length of an array by evaluating it in a scalar context – like adding 0 to it. This probably counts more as boilerplate than a defect, but still, I tripped more than once on this peculiarity.

Basically, because Rockstar wasn’t meant to be taken seriously, it is difficult to find a serious interpreter for it. I eventually used Satriani, a JS implementation that is also the reference for the language, but because of unsolved issues with piped input, I only did so after trying the Ruby implementation, and the Rust one – and none of them worked properly. I would be unkind to list the bugs I encountered with any of these 3 implementations or complain about them, but if you want to try out Rockstar, be prepared: its edges are still very rough.

Good Humor (Saint Etienne)

In the end, it took me 3 days to finish the first challenge. Granted, it was over a week-end, and I didn’t spend my whole days on it, but still – we’re talking orders of magnitude what would have taken me in Ruby, for example.

Trying to write a simple program in an unreliable, confusing and low-level language really made me feel like some very new developers I encountered in my career: quickly disoriented in the codebase, losing track of their initial intent, and resorting to trying out anything in the hope that it works, without understanding why. This is inefficient and unpleasant. It refilled my empathy for them.

Yet, even if I’m not entirely happy with my final result, I’m glad to see that I did not give up when put in this uncomfortable position. In fact, I could not let it go – like a Wordle from Hell, solving this challenge in Rockstar became a personal brain-teaser that I eventually overcame. Even if it drained all my desire to continue with the Advent of Code.

Who knows, maybe I’ll try again next year? But this time, I’ll be even more prepared, with a library of basic functions, and solid habits to keep track of the logic in the program before going over it and thinking about the lexical fields, and the different synonyms available for sex, drugs, and party.

Anyway, if you want to read my poetry, I’ve put it in a gist, and here is the uncommented version:

Mister Presents takes your wish, your sins and your prayers
Let the ice be your prayers
The judge is hypnotized
Shatter your wish
The heart is liveliness
Let the love be lies
Let the gift be your sins at the ice
Let the coal be your wish at the judge
Until the gift is nothing
Let the coal be your wish at the judge
If the gift is the coal
Let the love be true
Build the ice up
Build the judge up
Let the gift be your sins at the ice
If the love is true and the judge is as high as the heart with your wish
Let the truth be the ice without the judge
Give it back

Take it to the top

If the gift is your wish at the heart
The judge is perseverant
Build the ice up
Let the gift be your sins at the ice
Take it to the top

Let the love be lies
The judge is deflowered
Build the ice up
Let the gift be your sins at the ice




The Arbiter takes the sound
While the sound ain't nothing
Roll the sound into the vibe
If the vibe ain't mysterious
Rock the vibe into the wave


The crest is amplitudes
The rush is bewildering
Let the glory be the wave at the crest
Let the end be the wave without the rush
Let the pride be the wave at the end
Rock the glory
Rock the glory with the pride
Unite the glory into the dream
Burn the dream
Give it back




The beat says YELL!
Listen to the pulse
Shatter the pulse into your soul with the beat

The revelation is earthlight
The start is crucifixion
Your lover is joyfulness
The fear is subjugation
Let the dance be your lover without the fear
Rock you like "one"
Rock you like "two"
Rock you like "three"
Rock you like "four"
Rock you like "five"
Rock you like "six"
Rock you like "seven"
Rock you like "eight"
Rock you like "nine"
While your soul ain't gone
The sound is lies
Rock the sound
Roll your soul into my words
My sign is resilience
Your name is consequence
The idol is flamboyant
The herald is disharmony
Until the idol is my sign with you
Let the joker be your name with the idol
Let the drug be Mister Presents taking the joker, my words 'n' the herald
If the drug is as high as your lover
Let the sound at the drug be the joker
Let the herald be your name with the drug
Take it to the top

Let the herald be my sign
Build the idol up

The idol is disharmony
The herald is flamboyant
Until the idol is my sign with you
Let the joker be your name with the idol
Let the killer be you at the idol
Let the drug be Mister Presents taking the killer, my words 'n' the herald
If the drug is as high as your lover
Let the sound at the drug be the joker
Let the herald be your name with the drug
Take it to the top

Let the herald be my sign
Build the idol up

Let the faith be the Arbiter taking the sound
Let the revelation be the revelation with the faith

Shout the revelation