Child Script
Child script is a language so simple that even a 5 year-old child (Joe) could interpret it. It is composed of commands that mimic actions that most Joes would understand, yet it remains surprisingly usable. It bears some resemblance to assembly language, but the reasons for this will become clearer later on.
Language overview
Joe can interact with numbered boxes (akin to memory), where he can store small plastic balls. Additionally, he has access to an enormous (essentially infinite) ball pool, from which he can retrieve balls as needed. Supervising Joe's activities are two adults: his parents. Joe can display a box to one (Papa, serving as the output) and can request the other (Mama, or Joe's Mama :), acting as the input) to supply him with a specific number of balls, external to Joe.
Given Joe's limited reading skills, expecting him to follow text-based script would be ambitious. Instead, Joe follows a list of tasks represented by images, detailed in the Commands section.
Registers and memory
Besides the numbered boxes, there are 4 special boxes at Joe's disposal that aren't numbered. These are distinguished by their colors: Red, Green, Blue and Yellow. The Red box is where the magic happens: all math, logic and IO use the Red box. The Yellow box is used for addressing and finally the Green and Blue boxes are auxiliary.
Commands
Child Script currently defines the following commands:
Command | Description |
---|---|
X <COLOR>
|
Empties COLOR box into the ball park |
V O^<X>
|
Adds X balls to the Red box |
A O^<X>
|
Takes X balls from the Red box |
<-> <COLOR>
|
Swaps the contents of the Red box with the COLOR box |
<=> <COLOR>
|
Swaps the contents of the COLOR box with the box number @Yellow |
A>V <COLOR>
|
Dumps all balls in the COLOR box into the Red box |
= <COLOR>
|
Ensures COLOR box has the same number of balls and the Red box |
mama
|
Input to Red box |
papa
|
Output from Red box |
LABEL
|
Defines a color label that Joe can look for |
O? LABEL
|
Jumps to a color label if the Red box is not empty |
Joe ignores any line starting with `#` or `//` and any empty lines, but will be confused if other text appears.
Despite not knowing how to read, Joe can already recognize the words 'mama' and 'papa'. (It would be hard to get a decent representation in ASCII characters)
Technical details
Child Script source code is composed of ASCII characters only, since too many characters could confuse Joe.
"Memory" boxes are numbered 0 through 255. Joe is able to count up to this number. He didn't like to play with other kids, preferring to practice counting instead. All boxes are initially empty.
Each box can store up to 255 balls, but Joe will only move one at a time to avoid getting lost in his counting. If Joe tries to add a ball to a box that is already full, the box breaks and Joe's parents cleanup the mess, replacing the box and putting the balls back in the ball park, leaving the new box empty. If Joe tries to take a ball from an empty box, he will naturally fail. Joe being a persistent kid however, instead of giving up, he will ignore this removal and keep going.
At the age of five, Joe already understands redundant moves (e.g. Swap the Red box with itself) and promptly ignores them. He just wants to finish his job quickly to go practice counting some more.
External resources
- Reference interpreter by Didas72
- A cleaner version of the documentation, with no jokes or context.