Right from the day he won Mr Olympia, Arnold Schwarzenegger has been winning the hearts, and muscles of his fans for 45 years! That’s a long time. I know that there are plenty of Arnold’s diehard fans out there, heck I am one of those fans; But, you rarely (if ever!) stumble upon a programming language created, and based completely on an actor’s dialogues, from his movies.
Well, Lauri Hartikka did exactly that. He created a programming language based on Arnold’s one liners.
Introducing ArnoldC
IT'S SHOWTIME - is literally the syntax, and it's how you start writing your main method.
ArnoldC is an odd programming language, which is based on the one liners of Arnold - mostly from his movies. ArnoldC has been around for almost two years now, I just happen to stumble upon it very recently. Yea, I am kinda late to the game.
It’s very easy to use, and understand if you have some background in C, and Java watched most of Arnold’s movies, and watched some of them more than a couple of times.
It uses ASM to generate the Java (jar) bytecode, and Parboiled for parsing.
I’ve been playing with for sometime since last Monday, doing silly stuff. Trying to make the code sound funny, and some such. It’s remarkably fun to use. Yes, it has issues, and is very limited - for e.g a 16bit signed integer is the only variable type available for use. But if you are looking to have some fun while writing code, or want to learn some basic coding skills, and you’ve enjoyed watching Arnold’s movies, right from the time of Total Recall then ArnoldC is for you!
IT’S SHOWTIME - Syntax & A Small Program In ArnoldC.
TALK TO THE HAND - is literally the syntax, and it's also how you print your statements.
IT’S SHOWTIME
- is the exact syntax you will be using to begin your main method, if you plan on using ArnoldC. To close main then, you will be using YOU HAVE BEEN TERMINATED
Here’s The Smallest Possible ArnoldC Program:
1 IT'S SHOWTIME
2 YOU HAVE BEEN TERMINATED
As I mention above, you being your main method with IT'S SHOWTIME
, and terminate the main block with YOU HAVE BEEN TERMINATED
.
Printing Statements In ArnoldC
TALK TO THE HAND
“It’s fun using Arnold’s dialogues while writing this program. I keep smiling.”
Declaring Variables In ArnoldC
Declaring, and initialising variables is done using the syntax dialogues below.
HEY CHRISTMAS TREE myVar
YOU SET US UP 100
Writing A Fun, Small Program In ArnoldC
Here’s a program that calculates the average number of movies, and shows per year that star Arnold since his first movie (Hercules in New York) to Terminator Genesis, 2015.
Please Note: The only variable type available for use in ArnoldC is a 16bit unsigned int
. So, to begin with the whole point of the program is moot. But it’s still fun to code with ArnoldC.
The below is just a quick program for you to see how it all fits in, and how very readably fun it is.
1 IT'S SHOWTIME
2 HEY CHRISTMAS TREE avgMoviesPerYear
3 YOU SET US UP @I LIED
4 HEY CHRISTMAS TREE totalMovies
5 YOU SET US UP 56
6 HEY CHRISTMAS TREE years
7 YOU SET US UP 46
8 GET TO THE CHOPPER avgMoviesPerYear
9 HERE IS MY INVITATION avgMoviesPerYear
10 GET UP totalMovies
11 HE HAD TO SPLIT years
12 ENOUGH TALK
13 TALK TO THE HAND "Total Number of Movies done till date (2015 - via IMDB):"
14 TALK TO THE HAND totalMovies
15 TALK TO THE HAND "Avg Number of Movies/TV Shows Acted In Per Year, till date (2015 - via IMDB):"
16 TALK TO THE HAND avgMoviesPerYear
17 TALK TO THE HAND "Please note: The only variable type in ArnoldC is a 16bit integer. So the real average works out to be 1.2 movies per year"
18 YOU HAVE BEEN TERMINATED
Compiling & Executing It
Compiling is straightforward:
The name of the file on my machine is avgmovies.arnoldc
. The below is how you compile it.
java -jar ArnoldC.jar avgmovies.arnoldc
Executing the compiled file is easy:
java avgmovies
would run the program.
Making An Audible .Wav File While Compiling It.
You have the option to make an audible wave of your program while compiling using -declaim.
To create the audible output you can try the -declaim option:
It’s fun, especially when are trying to make sense of what should be said while writing a program.
java -jar ArnoldC.jar -declaim avgmovies.arnoldc
Be advised, if your program is a long one, this will tend to go on.
Click here to listen to the audible output of the above program
Get ArnoldC
To use ArnoldC, make sure you have Java SDK installed. As I mention above it uses Java for generating the bytecode.
1 wget http://lhartikk.github.io/ArnoldC.jar
2 echo -e "IT'S SHOWTIME\nTALK TO THE HAND \"hello world\"\nYOU HAVE BEEN TERMINATED" > hello.arnoldc
3 java -jar ArnoldC.jar hello.arnoldc
4 java hello
View the available syntax, and documentation
There’s Room For Improvement & Adding More One Liners.
Currently, there’s not a lot you can do with it. It is very limited, and has issues. However, it seems incredibly fun to code with.
Terminator Genysis was released this August. In the last two years, there have been many other releases. So, there’s room for more one liners in there somewhere.
ArnoldC, On Github
ArnoldC is an imperative programming language where the basic keywords are replaced with quotes from different Schwarzenegger movies. Parsing is done with Parboiled and ASM is used to generate the Java bytecode.