esolang

ArnoldC

Every keyword is a line from an Arnold Schwarzenegger film. The program starts with IT'S SHOWTIME.

Lauri Hartikka, 2013 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 4 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: Hello, World!

The idea

Lauri Hartikka made ArnoldC in 2013 and it became one of the best known joke languages. Underneath it is a small, ordinary language: integer variables, arithmetic, if, while and functions. The joke is the spelling. A variable is declared with HEY CHRISTMAS TREE, a loop is STICK AROUND, and a function ends with HASTA LA VISTA, BABY. True is @NO PROBLEMO and false is @I LIED.

Read the story

The reference compiler is written in Scala and turns programs straight into Java bytecode. Its parser is strict: one keyword per line, uppercase, exactly as quoted.

The machine

Values are 32-bit integers that wrap around. Number literals are a little smaller: the compiler loads them with a 16-bit instruction, so 40000 in a program becomes -25536.

KeywordDoes
IT'S SHOWTIME … YOU HAVE BEEN TERMINATEDThe main program
TALK TO THE HAND xPrint a number or a "string", with a newline
HEY CHRISTMAS TREE x / YOU SET US UP 5Declare a variable with its first value
GET TO THE CHOPPER x / HERE IS MY INVITATION y / … / ENOUGH TALKSet x to y, then apply each line in between
GET UP GET DOWN YOU'RE FIRED HE HAD TO SPLIT I LET HIM GO+ - * / %
YOU ARE NOT YOU YOU ARE ME LET OFF SOME STEAM BENNET== and >, giving 1 or 0
CONSIDER THAT A DIVORCE KNOCK KNOCKOr, and
BECAUSE I'M GOING TO SAY PLEASE x / BULLSHIT / YOU HAVE NO RESPECT FOR LOGICIf, else, end if
STICK AROUND x / CHILLWhile x is not 0
LISTEN TO ME VERY CAREFULLY f … HASTA LA VISTA, BABYDefine a function
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE aOne argument of the function
GIVE THESE PEOPLE AIR / I'LL BE BACK xThe function returns a value; return it
GET YOUR ASS TO MARS x / DO IT NOW f 1 2Call f, storing its result in x
DO IT NOW / I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELYRead a number

There is no precedence: an assignment's operations run top to bottom. A condition is always a single variable or number, so tests are worked out into a variable first. Mistakes such as an undeclared variable stop the program before it starts, with the reference's own message, lightly censored: WHAT THE F*** DID I DO WRONG.

Example

The console needs \n between lines, since every keyword sits on its own line.

The console needs \n between lines, since every keyword sits on its own line. Written out, a countdown looks like this:

IT'S SHOWTIME
HEY CHRISTMAS TREE n
YOU SET US UP 3
STICK AROUND n
TALK TO THE HAND n
GET TO THE CHOPPER n
HERE IS MY INVITATION n
GET DOWN 1
ENOUGH TALK
CHILL
YOU HAVE BEEN TERMINATED
Expected: 3 2 1
Expected: 144
Expected: -25536

The third program reads a number and squares it. The last one shows the 16-bit literals.

Patterns it teaches

It is not Turing complete in the strict sense: there are only fixed-size integers and no arrays.
  • Camouflage: a plain imperative language dressed up as film quotes, like LOLCODE in cat speak.

It is not Turing complete in the strict sense: there are only fixed-size integers and no arrays. Recursion gives it a stack, but a stack of bounded numbers is still not enough for any computation.

Try this

  1. Print the numbers 1 to 10.
  2. Write a function that returns the larger of two numbers.
  3. Hard: FizzBuzz. I LET HIM GO is the remainder.

Further

Pseudonatural

Write your own in Run Convert a program from ArnoldC

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: arnoldc.

Command line

shib run arnoldc -e 'IT'\''S SHOWTIME
TALK TO THE HAND "Hello, World!"
YOU HAVE BEEN TERMINATED'
shib manual arnoldc

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/arnoldc.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org