Rockstar Programmer or Poet

I’ve learned a few programming languages in my time. Sometimes for a particular project but also occasionally just for fun. So I was interested to find out that someone I knew had invented a programming language where the code looks like song lyrics; it’s called Rockstar.
What are song lyrics but a form of poetry and I like writing poetry so how could I resist. The best way to learn any language is of course to write a program in it, so I chose a simple example and had a go.

It was a fascinating experiment. Choosing a simple enough program to write made me aware of how many things I take for granted in most languages, things like bitwise operations or string manipulation. Writing this* into Rockstar led to a detailed study of the syntax. I made some guesses as to how things should work where the documentation wasn’t clear. I’ve followed some of the official example code and sometimes not. Using null as equal to zero and then incrementing it felt so wrong I just had to find another way.
Despite all this I found getting a ‘working’ Rockstar program is the easy part. Rewriting it to be sufficiently poetic took some time, including developing some of my own coding conventions which just shows how poetic code really is.

I’ll also admit to cheating slightly; the language as specified doesn’t have a random number function and I wanted one. So (based on C’s rand function) I’ve assumed a function that returns a random integer between zero and whatever maximum is available. I figure gambling is fairly rock star so that is an acceptable extension (I hope).
Because that function isn’t defined in my program I’ve added a way of showing that too. I hope I’ve also used comments in an interesting way.

Bring on Chance (my own invention)

Time takes my life and my tears
While my life is as strong as my tears
Put my life without my tears into my life

Give back my life

Simply takes a smile and a wave
Put a wave without a smile into the world
Build it up
Put Time taking Chance, the world into your life
Give back your life with a smile

Dreaming takes my hopes and my fears and my smiles and my tears
Shout my hopes
Whisper my fears
Shout my smiles
Whisper my tears

The sunshine was frightening
The shade was my compatriot
Your hopes were everything
My idea was wilder (no more than this)
Dreaming taking “I am thinking of a number between”, the sunshine, “and”, the shade
Put Simply taking the sunshine, the shade into my heart
While my idea is stronger than your hopes
Say “Take a guess.”
Listen to your dream
Build your hopes up
If your dream is smaller than my heart
Whisper “Your guess is too low.”
Take it to the top

If your dream is bigger than my heart
Whisper “Your guess is too high.”
Take it to the top

If my heart is your dream
Break it down

(and breathe)

If my heart is your dream
Dreaming taking “Good job!”, “You guessed my number in “, your hopes, ” guesses!”

If my heart ain’t your dream
Say “Nope. The number I was thinking of was ”
Whisper my heart
(no more)

*Obviously working out what this program actually does is left as an exercise for the reader

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s