improve error reporting java -> prolog for parser library