The representation of the way in which a sequence of words comes to be a well-formed sentence of a language. In a formal or artificial language grammar is laid down in formation rules, but the formation rules of natural languages are sufficiently complex to make accurate codification hazardous.