Metafuck

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Metafuck
Designed by Matrus
Appeared in 2024
Memory system Cell-based
Dimensions one-dimensional
Computational class Meta Turing-complete
Major implementations Original Python interpreter (pastebin)
Influenced by Brainfuck, MetaGolfScript
File extension(s) .mf(X)

Metafuck is a family of esoteric programming languages. Every single language in the family is a version of Brainfuck.

Overview

The family consists of infinite amount of languages, named Metafuck-X, where X is any string of any length (including 0). These strings are called dimensions. A dimension string consists of digits, letters (lower- and uppercase), punctuation, spaces, tabs, newlines (LF), carriage returns, vertical tabs and form feeds. The programs can only consist of digits, letters (lower- and uppercase), punctuation, spaces, tabs and newlines (LF).

  • Not all languages are turing-complete; for example, dimension "" (empty) will do nothing regardless of the program.

Dimension logic

Dimension strings are actually just numbers in base 100 that get converted into base 2. Then, ones and zeroes are mapped to generate a specific rule set, which is passed to an L-system, where the final Brainfuck program is generated.

Dimension examples

Brainfuck

Here's a dimension that acts the same as Brainfuck (359 bytes):

15w KGy_\f<t=xXE g7$qb@`V4-[PaVY9C(^
v6wush/Q
cz9'A{gM
 Z[	IH~p9aFT%,M%wpbjivL1qr�{	p;{&A!aYZ-#y
Ab_@4V`4J?x<m�A�>Tlu�!RA/{>j*@IP�A{9jtwN+?Dk)I)+4A'FLEFg,b#Z';>zA&nQF()2*z5b.
30V]pPbb~�H	2pa[uNU.|"nu&isi0n-nxp�=�zKN`p7EIm��yBhad,V7}K	b XeTsp?N@wukGxs<bG+yrv~$CHfS�CV21,Qh(U
c?,>rqTzt?3 
{X cS)}C^%r	Bn[@O|w[l(DB(w&U|:9Cb9a2H(._ZVrAY4Y9MLLP3B]/jLbx
N1S5j~Y

Note: this might be incorrect because of the presence of the following characters: \x0b \x0c

This looks.. weird. Here is the same thing in base 10:

1053294464234888515792980335940941607652611838957047484511057600938698797310632302817765296123509683690164896946184954443932509104155667348663225111918314701262798909525789067366210606174643496361188830457890445823379229836988155213099625336769081197183445199369009192932497282392070447072043668414740411673116461687881353667235241697002713505117597030057862551111193984395022510843049567591632330671828180023742333259980983546498925074044229898343717101373570792469511945914552825824983323020423328791142723427319365384315549838570201735217695696128273812726553529820394979059941254709238876627953723848350913284216939376932675691770938110910024369758861572736600460094847475103378676194711339749015405199360

If you convert this number to binary, you will see a lot of zeroes in the beginning. Behind the scenes, there are a lot more.

This is a minimal 1:1 recreation: all characters that are not in the brainfuck charset are mapped to nothing, and if they are in the charset, they get mapped to self.

Every character is left as-is

A dimension where every character is mapped to self is 1431 bytes. You can view it here (pastebin).

Newline mapped to .+[.+]

A dimension where the newline character is mapped to .+[.+] and everything else is mapped to nothing looks like this (33 bytes):

5qUeWyr\~y`X1CINHli>o(!�RVA5
XG.[

Note: there is the following character: '\x0c' after the symbol '!'

Implementations

JavaScript (Online)

There is an ongoing developement of an online interpreter that uses JavaScript. It is not public version of it yet.

Python

Original implementation: [https://pastebin.com/raw/2Brys35S metafuck.py (autopep8 / pastebin)

Metafuck code is piped. The dimension is specified via command line arguments. Example usage:

 B:\> rem Windows
 B:\> type program.mf | python metafuck.py dimension.txt
 $ /* UNIX-like systems */ 
 $ cat program.mf | python3 metafuck.py dimension.txt