The language brainfuck is extremely minimalistic, consists of only eight commands and is Turing complete. Writing an interpreter for it in Prolog is a breeze.
You can download my interpreter here. I’ve included some brainfuck programs I found at ‘The brainfuck archive’.
To start a brainfuck program from Prolog do the following:
:- run_bf_program('hellobf.bf').
It’s not the fastest interpreter around, but it’s a nice example of how to build one in Prolog.