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
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.
| Keyword | Does |
|---|---|
IT'S SHOWTIME … YOU HAVE BEEN TERMINATED | The main program |
TALK TO THE HAND x | Print a number or a "string", with a newline |
HEY CHRISTMAS TREE x / YOU SET US UP 5 | Declare a variable with its first value |
GET TO THE CHOPPER x / HERE IS MY INVITATION y / … / ENOUGH TALK | Set 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 KNOCK | Or, and |
BECAUSE I'M GOING TO SAY PLEASE x / BULLSHIT / YOU HAVE NO RESPECT FOR LOGIC | If, else, end if |
STICK AROUND x / CHILL | While x is not 0 |
LISTEN TO ME VERY CAREFULLY f … HASTA LA VISTA, BABY | Define a function |
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE a | One argument of the function |
GIVE THESE PEOPLE AIR / I'LL BE BACK x | The function returns a value; return it |
GET YOUR ASS TO MARS x / DO IT NOW f 1 2 | Call 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 IMMEDIATELY | Read 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
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
- Print the numbers 1 to 10.
- Write a function that returns the larger of two numbers.
- Hard: FizzBuzz.
I LET HIM GOis the remainder.
Further
- esolangs.org/wiki/ArnoldC
- The reference compiler, in Scala, with a tutorial in its wiki
See also
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 arnoldcSource
- 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