Attribute grammars in Prolog