Compiler Homework with Prolog