esolang
Learn · LessonsLesson 7 of 18

Lesson 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.

The lesson

plain=off in the header means only rules are read. The brainfuck bodies use the kernel's pointer. PTR LOAD reads the current cell, PTR STORE writes it and 1 MOVE steps right.

The example is a letter spelling of brainfuck. p is plus, m minus, r right, l left, o out, i in, and ( and ) are the loop.

Brainfuck substitutions shows the substitutions people have made. The Studio's Make a language tab writes these files with a form, and the .shib format in the Docs lists every header setting.

Example

Change the language file or the program, then run it.

Output


Exercise 1

Finish the letter spelling. Add the rules for m r l i ( ) so the test programs run as brainfuck.

Write the rules in the language file. Check runs every test program with your language.

The tests they must pass
ProgramInputExpected output
i(oi)hellohello
ipoab
irioloxyyx
imoba
pppppppp(rpppppppplm)rpo(empty)A

Output


A hint

Copy the bodies of the brainfuck dictionary. , reads (end of input becomes 0), [ is PTR LOAD IF BEGIN and ] is PTR LOAD NOT UNTIL THEN.

One answer

Answer: Finish the letter spelling. Add the rules for m r l i ( ) so the test programs run as brainfuck.

Expected output

hello
The tests they must pass
ProgramInputExpected output
i(oi)hellohello
ipoab
irioloxyyx
imoba
pppppppp(rpppppppplm)rpo(empty)A

Output


Read more