Lessons · 18 lessons · 35 graded exercises
From a first brainfuck program to your own language
Write a program and press Check. It runs on every test and against the exercise’s rules. Progress is saved in your browser.
- Brainfuck's row of cells done
Brainfuck has a long row of byte cells, all zero, and a pointer at the first one. Four of its eight commands work on the cell under the pointer. - Moving the brainfuck pointer done
>moves the pointer one cell right,<one cell left. Each cell keeps its value while the pointer is elsewhere, so cells serve as variables. - Loops in brainfuck done
[jumps past its matching]when the cell under the pointer is zero;]jumps back to its[when it is not. That is the only control flow brainfuck has. - A brainfuck multiplication loop done
AnAwritten out takes 65 plusses. A loop with a counter builds a large number in a few commands. - Hello World in brainfuck done
The classic Hello World nests two multiplication loops to set up several cells near the letters it needs, then nudges each one into place before printing. - Ook! is brainfuck in other clothes done
Ook! is brainfuck spelled with pairs of orangutan words. Each of brainfuck's eight commands becomes two words. - Write a substitution done
In this lesson you write the dictionary. Each line"pattern" => tokensis a reading rule. Wherever the program text has the pattern, the kernel runs the tokens. - Deadfish and its one number done
Deadfish has a single accumulator and four commands.iadds one,dtakes one away,ssquares andoprints the number in decimal and a newline. It cannot read input or loop. - Deadfish's 256 reset done
Deadfish has one odd rule. Whenever the accumulator becomes exactly 256 or exactly -1, it is reset to 0. - Quotations in Underload done
Underload has no numbers at all; its stack holds texts.(text)pushes a text,Sprints the top one,:duplicates,!drops,~swaps and*joins the top two. - Code is data in Underload done
^pops a text and runs it as a program. So(:*)is a function; run on(x), it doubles it. - The Underload quine done
A quine is a program that prints its own source. In Underload it is short, becauseaturns a text back into the source that pushes it. - The kernel's stack of numbers done
Every language in these lessons runs on one kernel, a stack machine. Read without rules, a program is a list of kernel tokens. - Loops and choices in the kernel done
The kernel steers a program three ways. A loop that counts, a choice, and a loop that runs until a condition is true. - Lists and CALL in the kernel done
[ ... ]pushes the text between the brackets as one value, a list of characters. - map, filter and fold as words done
A dictionary can hold words as well as rules. This one makesmap,filterandfoldout of kernel tokens and CALL. - Rules that change while running done
[ name ] [ body ] DEFINEbinds a name while the program runs. A lowercase name becomes a word; anything else becomes a reading rule, and an existing rule with that pattern is rebound. - Write your own esolang done
In these lessons an esolang is a dictionary. A header line, reading rules from patterns to kernel tokens, and words make up the whole definition.