b

brain-transplant

@preview

Transpile Brainfuck code to Typst

v0.1.0
MIT-0

Package Information

Last Updated
Minimum Typst Version
0.13.0
Categories
scriptingfun
Disciplines
computer-science

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/brain-transplant:0.1.0

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/brain-transplant:0.1.0": *

Version History

0.1.00.13.0
7b38d1dbb2bb...

The logo of the package, which features a minimalist icon of a brain with < on the left hemisphere and > on the right, in a turquoise square Brain transplant: A Brainfuck-to-Typst transpiler written in Typst

Package on the Typst Universe
Git repository
A precompiled PDF file of the manual
Licence: MIT-0

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