ALLCAPS

From Esolang
Jump to navigation Jump to search

ALLCAPS is a Turing complete interpreted esoteric programming language invented by User:BliepMonster. The interpreter crashes when the interpreted program contains a lowercase character anywhere.

Example programs

Hello World

It is relatively easy to write a Hello world program in ALLCAPS:

PUSH STRING 'HELLO, WORLD!'
PRINT CHAR ALL

Note that it is not possible to replace the single quotes with double quotes.
Also, if you wanted to make it print lowercase letters, you would have to print the ascii values one by one, as the mere existence of lowercase letters is banned.

Cat program

The following program reads the user's input and prints it back:

INPUT LINE ON STACK
PRINT CHAR ALL

Fibonacci Sequence

The following infinite loop prints the fibonacci sequence infinitely:

PUSH INT 1
ALLOC 0 0
PUSH INT 1
ALLOC 1 1
PUSH INT 0
ALLOC 5 5
PUSH INT 1
ALLOC 2 2
RETRIEVE 2 2
DUPLICATE
PRINTLN INT 1
PRINTLN INT 1
LABEL LOOP_START
    WAIT 500
    RETRIEVE 0 0
    RETRIEVE 1 1
    ADD
    DUPLICATE
    DUPLICATE
    PRINTLN INT 1
    ALLOC 2 2
    RETRIEVE 5 5
    RETRIEVE 5 5
    ALLOC STACK STACK
    RETRIEVE 5 5
    INVERT
    ALLOC 5 5
GOTO LABEL LOOP_START

Infinite loop

It is very simple to implement an infinite loop in ALLCAPS. It is possible in only one line:

GOTO LINE 1

Truth Machine

FUNCTION ON_ZERO
    PUSH INT 0
    PRINT INT 1
    END
QUIT
INPUT INT
INVERT
IF STACK EXECUTE FUNCTION ON_ZERO
LABEL LOOP_LABEL
PUSH INT 1
PRINT INT 1
GOTO LABEL LOOP_LABEL

Interpreters

A Java interpreter can be found here.