Skip to content
/ xfuck Public

Cross-platform font-based programming language

Notifications You must be signed in to change notification settings

mgunyho/xfuck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xfuck

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:

hello-x

You can see the full source code for this example in examples/hello-x.pdf.

xfuck was inspired by this xkcd:

https://imgs.xkcd.com/comics/x.png

xfuck was created as part of stupid hack 2020.

Usage

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.

Language specification

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.

About

Cross-platform font-based programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages