Package Information
- Last Updated
- Minimum Typst Version
- 0.13.0
- Authors
- Maja Abramski-Kronenberg
- Categories
- scriptingfun
- Disciplines
- computer-science
1. Get the package
Download the package using the TPIX CLI:
tpix get @preview/brain-transplant:0.1.02. Import in your Typst file
Add this to your .typ file:
#import "@preview/brain-transplant:0.1.0": *
Brain transplant: A Brainfuck-to-Typst transpiler written in Typst
This package provides a Brainfuck-to-Typst transpiler.
Let’s unpack this mouthful gibberish.
Brainfuck is a minimalist esoteric programming language that consists of only eight simple instructions yet is Turing-complete (which essentially means everything computable by a fully-fledged language on a computer is in principle computable by it and vice versa).
A transpiler is a program that translates a program given in a certain programming language to an equivalent program in another language.
In our case the package takes a program written in Brainfuck and translates it into Typst code, which can then be displayed or run (evaluated); for example:
#import "@preview/brain-transplant:0.1.0": *
#raw(brain-transplant("+++++++[->,.<]", input: "Hi Mom!", evaluate: true))
The output is:
Hi Mom!
All this has no real practical use, but it’s very amusing (mindbogglingly so even 🤯) if you’re into programming, minimalism, recreational and artistic use of math and technology, formal rules, meta and the like.
📖 The manual
Using brain transplant is quite straightforward.
A comprehensive manual covers:
- Introductory background.
- How to use the provided function (
brain-transplant()). - Example Brainfuck programs and their outputs.
📦 Other Typst packages by me
I really like Typst, its structure, its community and the freedom and accessibility it brings to writing packages (compared to LaTeX). Another package I wrote is:
- 🗼 Babel: Redact text by replacing it with random characters