esolang

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.

Start lesson 1

  1. Brainfuck's row of cells
    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.
  2. Moving the brainfuck pointer
    > moves the pointer one cell right, < one cell left. Each cell keeps its value while the pointer is elsewhere, so cells serve as variables.
  3. Loops in brainfuck
    [ 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.
  4. A brainfuck multiplication loop
    An A written out takes 65 plusses. A loop with a counter builds a large number in a few commands.
  5. Hello World in brainfuck
    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.
  6. Ook! is brainfuck in other clothes
    Ook! is brainfuck spelled with pairs of orangutan words. Each of brainfuck's eight commands becomes two words.
  7. Write a substitution
    In this lesson you write the dictionary. Each line "pattern" => tokens is a reading rule. Wherever the program text has the pattern, the kernel runs the tokens.
  8. Deadfish and its one number
    Deadfish has a single accumulator and four commands. i adds one, d takes one away, s squares and o prints the number in decimal and a newline. It cannot read input or loop.
  9. Deadfish's 256 reset
    Deadfish has one odd rule. Whenever the accumulator becomes exactly 256 or exactly -1, it is reset to 0.
  10. Quotations in Underload
    Underload has no numbers at all; its stack holds texts. (text) pushes a text, S prints the top one, : duplicates, ! drops, ~ swaps and * joins the top two.
  11. Code is data in Underload
    ^ pops a text and runs it as a program. So (:*) is a function; run on (x), it doubles it.
  12. The Underload quine
    A quine is a program that prints its own source. In Underload it is short, because a turns a text back into the source that pushes it.
  13. The kernel's stack of numbers
    Every language in these lessons runs on one kernel, a stack machine. Read without rules, a program is a list of kernel tokens.
  14. Loops and choices in the kernel
    The kernel steers a program three ways. A loop that counts, a choice, and a loop that runs until a condition is true.
  15. Lists and CALL in the kernel
    [ ... ] pushes the text between the brackets as one value, a list of characters.
  16. map, filter and fold as words
    A dictionary can hold words as well as rules. This one makes map, filter and fold out of kernel tokens and CALL.
  17. Rules that change while running
    [ name ] [ body ] DEFINE binds 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.
  18. Write your own esolang
    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.