CMC logo Cave Man Code

CMC is deliberately small. There is one thing per line, blocks end with unga, and notes start with ugg.

The shape of a program

ugg notes first (optional)
grunk boxes
clump helpers
booga / binga / zug / zoop blocks
oga answers

The computer reads from top to bottom. A clump must be made before you call it. A box must be made before you use it.

Lines

boxes). The CMC words themselves are always lowercase, but English aliases like PRINT also work because the words are matched without case.

Blocks

Every block starts with a word and ends with unga:

binga <check>
    <things>
unga

booga <count>
    <things>
unga

zug <check>
    <things>
unga

zoop <name> in <pile>
    <things>
unga

clump <name>(<boxes>)
    <things>
unga

Blocks can live inside blocks. Every block needs its own unga:

booga 3
    binga lap == 2
        oga "the middle lap!"
    unga
unga

An unga with nothing open gives a friendly error, and a missing unga does too.

Statements

StatementMeaning
oga <things>print
grunk <name> = <thing>make a box
<name> = <thing>change a box
<pile>[<spot>] = <thing>change one spot of a pile
binga / booga / zug / zoop / clumpblocks
ork <thing>give an answer back
skrib <shape> <args>draw
<clump>(<args>)call one of your clumps

A line that only makes an answer without using it (like 5 + 5 alone) gets a kind error that suggests oga.

Expressions

Expressions are how you build values. From strongest glue to weakest:

LevelWhatExample
1numbers, text, names, (...)42, "hi", x, (1 + 2)
2spots and callspets[0], double(4), snorf(1, 2)
3minus in front-5, -(a + b)
4* / %6 * 7, 10 % 3
5+ -2 + 3, a - b
6== != < <= > >= in not inrocks >= 3, "cat" in pets
7notnot gronk
8anda > 1 and b > 1
9ora == 1 or a == 2

You never compare three things at once. 1 < 2 < 3 gives a friendly error telling you to use and.

Names you invent

Good names say what is inside: rocks, player_name, total_score.

Text details

Text can contain escape codes:

WriteYou get
\na new line
\ta tab
\"a quote
\\a backslash
\u2764a character by code point

Text cannot run over more than one line. Use + to join pieces.

Numbers

decimal (5 / 2 is 2.5)

What the parser checks for you

All of these come with a line number and a hint. See Errors.