Icon

New website

Computer Nerd Stuff (INTERCAL)

My program

A friend of mine challenged me to write an actually useful program in INTERCAL. If you are lucky enough to never have heard of it, below is a little introduction.

Of course I took the challenge and wrote a little intercal program: [labyrinth.i] (install INTERCAL with apt-get install intercal, compile with ick labyrinth.i and execute with ./labyrinth (INTERCAL code can only access stdin and stdout so it is perfectly safe)). I am willing to give you a commented version of the source code, but to keep up with INTERCAL's tradtions, you have to send me an email which includes the word "PLEASE" and "wimp".

I also attempted to make a BNF diagram of C-INTERCAL's syntax: BNF Notation (hand drawn), (as tex), (as pdf)

Introduction

INTERCAL is a programming language which essentially does everything a good programming language is not supposed to do to make programming as much an unneccessary pain as possible. To give examples:
  • As if "GOTO" were not bad enough, INTERCAL has the even worse "COME FROM".
  • AND, OR and XOR are unary operators!
  • There is no "IF": If you want conditional code, you have to write two "NEXT" statements; (which is the equivalent of "CALL" in assembly language and jumps to a piece of code leaving a return address on the stack) and then substract from the stack pointer the value of the conditional variable (with "FORGET") so that "RETURN" will get you to different places.
On the plus side:
  • There are only
    • 3 (admittedly unusual) unary operators
    • 2 (admittedly really weird) binary operators
    • 14 statements (including "GIVE UP")
  • it teaches you politeness by checking whether you used the keyword "PLEASE" often enough, but not too often.
  • Really the perfect Beginner's language
  • It seems like google is catching on and might make more use of this superb programming language: Google INTERCAL Style Guide.


I am not responsible for the content of other pages that this page links to, nor do such pages necessarily agree with my own opinion.