The Semantics and Pragmatics of Gringo