TiddlyWiki Brainf**k implementation without special JS (or: possible proof TiddlyWiki widgets and filters are probably turing complete)

For the last couple days I’ve been working on a bf interpreter implementation on TiddlyWiki. I limited myself only to stuff TW provides by default and no extra JavaScript (otherwise it would be way too easy), so it has been done entirely with widgets, filters, fields and other TW features.

While it’s “done” enough to run “Hello World” and some other smaller stuff, there are some issues particularly with how loops work (probably fixable), “character output” (.) has some [[space escaping issues]] (definitely fixable), and “character input” (,) is not implemented yet (it should be easy, I’m just
lazy).

A drawback that probably can’t be fixed with this approach is that you need to repeatedly click a button to continue execution because (from what I know) you cannot use action widgets without a button (or another interaction) (Also, needing human interaction to make something turing complete has precedent)

The underlying code isn’t the greatest. I was focused on getting it working rather than making it clean.

Without rambling even more, here it is: https://ebc.li/#TiddlyBF

2 Likes

Most impressive!!
What can we do with it?! :smiley:
About the only thing I know about brainf***k is people were impressed some years ago when it was done in the game SpaceChem.

TLDR: not much

(as far as I know) Because bf is turing complete, it can, in magical theory computer science land where memory is infinite and things just work, do anything any computer can do (like, run a browser and run TiddlyWiki inside it)

In practice, even the hello world demo is slow and takes a lot of clicks to complete (in my implementation), not to mention bf in general being a clunky language to program for.

To realistically make this do anything other than being a fancy proof of concept, there would be way more pieces than just the bf interpreter. (Something converting human readable code to bf instructions, Something to interpret numbers in the tape as graphics or sound or this or that, etc.)

As a comparison to “real” computers: This is just the CPU core (and maybe memory) implementation, by themselves these components can’t really do anything other than numbers.