Formal grammar

A formal grammar says how to form an expression or a word, that is valid in a formal language. In the 1950s, Noam Chomsky classified formal grammars, into what is known as Chomsky hierarchy today: There are four different types of such grammars, numbered 0 to 3. Higher level grammars are stricter than lower level grammars.