Skip to content
Sean's Itty Bitty Programming Language
C
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
LICENSE
Makefile
README.markdown
TODO.org
hello.itty
itty.c
pi.itty

README.markdown

Itty

Sean's Itty Bitty Language

Itty is a stack-based language with single-character words, inspired primarily by False and Mouse.

Examples

hello.itty is the classic hello world.

pi.itty is an unbounded pi spigot; it will print the digits of pi until the cows come home. IMHO this is a much better hello world for this language; it's actually why I developed Itty in the first place.

Variables

Currently there are 26 global variables represented by the ASCII capital letters, and 26 local variables represented by the ASCII lowercase letters. This will change: I intend to implement nested scope and allow all 52 variables to exist in any scope.

Variables are set with :, fetched by typing just the letter. Functions stored in variables will be evaluated rather than being put on the stack; to actually put the function on the stack use ; (not yet implemented).

To set a bunch of variables at once, enclose the names in single quotes, for example: 'abcd' will pop d, then c, then b, then a. This makes it a lot easier to read and write functions that take multiple arguments, since it's traditional to put arguments on the stack in reverse order.

Blocks

Blocks are created by enclosing code in square brackets ([ and ]). Call a block unconditionally with ! or conditionally with ?. ? Takes three arguments: a boolean (0 for false or nonzero number for true), a true case block, and a false case block. To leave one out just use an empty block. To execute a tail call, make sure the ? or ! comes right before a ]; whitespace will break the tail call detection code (this is a bug).

Input

There is no input right now. Suggestions welcome.

Output

Comma (,) will print the ASCII character corresponding to the number on the top of the stack. Print a newline with 10, or a tab with 8,. To print a string, enclose it in double quotes. Strings may eventually be first class, so this may change. There is no escape character; to print double quotes use 34,.

Period (.) will print the object on top of the stack, with no newline.

Math

Numbers are represented by sequences of decimal digits. Only positive integer constants can be represented. To put a negative number on the stack, subtract from 0 or use the unary negation (_) operator.

Only integers are supported; they are implemented as bignums using GNU MP. Addition (+), subtraction (-), multiplication (*), floor division (/), and modulo (%), and unary negation (_) are supported. Other popular math functions that would be too slow to implement in Itty will eventually go into a math module once I have modules.

Booleans

Nonzero represents true; zero represents false. Operations are unary not (~), binary and (&), and binary or (|). I may add xor in the future using ^, which is currently the trace operation, and move trace to a debug module once I've implemented namespaces.

Debugging

There is currently only trace (^). Eventually debugging functions will get their own module.

Something went wrong with that request. Please try again.