xfuck
(pronounced 'crossfuck') is an esoteric programming language based on fonts. It is revolutionary, portable and minimal - an interpreter can be written in less than 300 lines of Python.
The source code of an xfuck program consists the fonts embedded in a PDF, interpreted as brainfuck commands. This provides incredible flexibility, and a rich ecosystem of literally billions of already existing valid programs.
In addition, PDF output is so ubiquitous that xfuck enables the user to program in a wide range of development environments, which were previously unsuitable for programming. These include (but are not limited to) Microsoft Word, Excel, LaTeX, HTML files (via printing to PDF), or even by hand on a plain piece of paper with the help of an OCR program. The possibilities are truly endless.
For example, a program that prints 'hello world' looks like this:
You can see the full source code for this example in examples/hello-x.pdf
.
xfuck was inspired by this xkcd:
xfuck was created as part of stupid hack 2020.
Install dependencies (python 3):
pip install -r requirements.txt
Run an xfuck program with the following command:
./xfk inputfile.pdf
To output the brainfuck source generated by xfuck instead of executing it, give a .bf
file as an extra parameter:
./xfk inputfile.pdf outputfile.bf
To convert a brainfuck source file to an xfuck-compatible pdf, run the command
./xfk source.bf
This creates the file source.pdf
.
xfuck source files are PDF files. The first eight characters of the pdf should have eight different fonts, each corresponding to one command of brainfuck. Whitespace is ignored.
Originally (version 1.0, released 2020-05-23 8:42), the only allowed text in the PDF were the character 'X'
and the string X Æ A-12
. This was extended in version 2.0 of the specificatoin (released 2020-05-23 17:25), so that all characters are allowed. Other content, such as images or embedded SWF files are ignored.