Rockstar Documentation

Introduction

Rockstar is a dynamically typed Turing-complete programming language designed for creating computer programs that are also song lyrics. Rockstar is heavily influenced by the lyrical conventions of 1980s hard rock and power ballads. It was created by Dylan Beattie in 2018, based on this tweet from Paul Stovell, which said "To really confuse recruiters, someone should make a programming language called Rockstar."
    Although Rockstar is a fully-specified language with multiple implementations, it was created primarily to satirise the use of the phrase 'rockstar developer' in IT job listings and recruitment - the joke being that if Rockstar is a real programming language that's easy to learn, then anybody who wants to invest a few minutes in it can legitimately call themselves a 'rockstar developer'.

The Rockstar Language Specification

Variables

Rockstar supports three kinds of variable names.

Simple variables are valid identifiers that are not language keywords. A simple variable name must contain only letters, and cannot contain spaces.

Variable is 1
Tommy is a rockstar
X is 2

Common variables consist of one of the keywords a, an, the, my or your followed by whitespace and a unique variable name, which must contain only lowercase ASCII letters a-z.

My variable is 5
Your variable is 4

Proper variables are proper nouns - any word that isn’t a reserved keyword and starts with an uppercase letter.Proper variable names can contain spaces as long as each space is followed by an uppercase letters

Poetic Number Literals

A poetic number literal begins with a variable name, followed by the keyword is, or the aliases was or were. As long as the next symbol is not a Literal Word, the rest of the line is treated as a decimal number in which the values of consecutive digits are given by the lengths of the subsequent barewords, up until the end of the line. To allow the digit zero, and to compensate for a lack of suitably rock’n’roll 1- and 2-letter words, word lengths are parsed modulo 10. A period (.) character denotes a decimal place. Other than the first period, any non-alphabetical characters are ignored.

Comparison

Similar to the single-equals operator in Visual Basic and some scripting languages, the is keyword in Rockstar is interpreted differently depending whether it appears as part of a statement or as part of an expression. isn't is the logical negation of the is keyword.

The keyword ain't (which is reduced to aint by Rockstar) is an alias for isn't. This usage runs contrary to idiomatic English, where “Tommy isn’t anybody”, “Tommy ain’t nobody” and “Tommy ain’t not nobody” somehow mean exactly the same thing.

Rockstar also supports the following comparison syntax:

Input/Output

Use the Listen keyword to read one line of input from STDIN. Use Listen to to capture the input into a named variable.

Listen to your heart - read one line of input from STDIN and store it in your heart

Use the Say keyword to write the value of a variable to STDOUT.

Say Tommy - will output the value stored in Tommy to STDOUT

Rockstar defines Shout, Whisper and Scream as aliases for Say

Loops

Similar to the If statement, a loop is denoted by the While or Until keyword, which will cause the subsequent code block to be executed repeatedly whilst the expression is satisfied:

Tommy was a dancer
While Tommy ain't nothing,
Knock Tommy down

That’ll initialize Tommy with the value 16 (using the poetic number literal syntax) and then loop, decrementing Tommy by 1 each time until Tommy equals zero (i.e ain't nothing returns false).

The break and continue statements work as they do in most block-based languages. Rockstar defines Break it down as an alias for break and Take it to the top as an alias for continue

Examples

Here is the 'Hello World' program in Rockstar

Say "Hello World"

Now here is FizzBuzz in idiomatic Rockstar, using poetic literals and no indentation.

Midnight takes your heart and your soul
While your heart is as high as your soul
Put your heart without your soul into your heart

Give back your heart

Desire is a lovestruck ladykiller
My world is nothing
Fire is ice
Hate is water
Until my world is Desire,
Build my world up
If Midnight taking my world, Fire is nothing and Midnight taking my world, Hate is nothing
Shout "FizzBuzz!"
Take it to the top

If Midnight taking my world, Fire is nothing
Shout "Fizz!"
Take it to the top

If Midnight taking my world, Hate is nothing
Say "Buzz!"
Take it to the top

Whisper my world