Panini covered both the grammar in the regular sense as well as the phonology of the language. "Optimality theory" attempts to model phonology as a collection of violable constraints operating with a least violation principle. It is supposed to be more generally applicable to what we normally know as grammar (dealings at the words/phrases level), but has seen most success with phonology.