intbigot
intbigot - the language for zealots without a cause

The intbigot Primer - v0.0.1


So, you've decided to convert to the ways of the One True Data Type, huh? Ready to leave all those other, lesser data types in the dust, are you? Excellent. Let's get crackin'.

An intbigot program consists of one or more procedures, or PROCs, which can contain VARiables (obviously integers) and statements. All procedures return a value. Procedures do not take arguments; that's why we have dynamic scope, you pansy. The intbigot interpreter will execute the first procedure in your program when you run it.

Let's write our first intbigot program now. Instead of the usual boring "Hello world" example, we will instead use intbigot to tell the world just how cool you are for using intbigot.


# Example 1 - I IS ELEET
PROC main
{
  PRINT 1;
  PRINT 15;
  PRINT 31337;
  PRINT NEWLINE;
  RETURN 0;
}

This program simply prints out "1 15 31337" into stdout, thus confirming your status as one elite d00d. Note that the "#" character is used to denote that the rest of the line is a comment and should be ignored, and, if possible, scorned, ridiculed, and not allowed to participate in any reindeer games whatsoever.

Now, the time may eventually come when you'll want to do something a little more complex with intbigot. Never fear, because intbigot is designed to do the impossible! Let's see an example in which the main procedure calls another procedure, with wacky and hilarious consequences!


# Example 2 - Operation: Print Random Crap
PROC main
{
  VAR foo;
  VAR bar;

  foo = (1 + 2) * 3 / (5 - 4);
  bar = showfoo();
  PRINT bar;
  PRINT NEWLINE;
  RETURN bar;
}

PROC showfoo
{
  PRINT foo;
  RETURN 42;
}

"But the showfoo procedure doesn't have a variable named foo to print out! How does it know? Dear God, how does it know??" I hear you cry. Never fear, for the miracle that is dynamic scope is here! When a procedure can't find a variable in its own locals, it checks the procedure that called it! If it's not there, then it checks the procedure that called THAT, yadda yadda yadda, all the way down the stack. If the variable has yet to be instantiated anywhere on the stack, intbigot will defenestrate itself. Violently. (And in the current incarnation of the interpreter, it doesn't check to see if the variable has been defined anywhere at all!) Best of all, dynamic scoping is the only way to pass data between procedures!

If you thought the last example was cool, check this one out:


# Example 3 - Behold the miracle of gravity, in all its glory!
PROC main
{
  VAR greeting;

  greeting = 5;
  hello();
  salut();
  gooddayeh();
  RETURN -82;
}

PROC hello
{
  VAR greeting;
  
  greeting = 2;
  RETURN greet();
}

PROC salut
{
  VAR greeting;
  greeting = 9563;
  RETURN greet();
}

PROC gooddayeh
{
  RETURN greet();
}

PROC greet
{
  PRINT greeting;
  RETURN greeting;
}

BOOYAH! What do you think this does? Go on, write down what the output should be. If you guessed "2 9563 5", then you get a GOLD STAR!

Now, you're probably wondering, "Well, this is cool and all, but how do I control the flow of my program? You know, loops and if statements and all that?"

You don't.

This concludes our primer.


Webpage and ridiculous langauge design by Jeremy Penner.