Implementation of the PROLOG interpreter (bonus challenge of lecture 'Logic for Computer Scientists', sheet 3, exercise 5)