Pāḷi is the 'language' the early discourses and analyses of Buddhism are recorded into. The Theravada tradition used oral transmission for centuries, but we nowadays have proofs (from archeological scrolls) that such a transmission was a lot more reliable than one would naïvely expect: we have been able to show that only a few syllables might get wronged over almost two millenia!
In a recent book, Buddhism and Pali, Prof. Gombrich (the? leading authority on Pāḷi) argued that Pāḷi might well in fact be the language the Buddha spoke, rather than an artificial language created solely for the purpose of storing knowledge.
One of the key arguments —in my view— are the weird features of the language, which makes the voluntary construction of an artificial language unlikely, in particular in the cultural context of Sanskrit, as Sanskrit has precise and rigid rules.
• If a well-established language was sought for storage, Sanskrit would simply have been chosen; language doesn't have truth-value in Buddhism, and translations were always allowed, hence Sanskrit would have been so convenient it would have won the day;
• If a competitor language had been willed into existence, to distinguish Buddhism from Brahminism, it would have… competed: it would have a precise structure, clear rules, unambiguous constructs! Pāḷi is anything but!
The irregularities, in fact, are so 'bad' that there's a strong case to suggest that it's a mix of local dialects, rather than a 'rational' construct. Pāḷi is based on Kosalī, extended by local dialects (in particular Māgadhi). There are many ways to say the same thing, sometimes many declensions for the same word (in the very same number, gender, case): the 'ablative' singular of dhamma might thus be dhammā, dhammasmā or dhammamhā while the 'locative' singular might be dhamme, dhammasmiṃ, or dhammamhi ! The 'optative' of a verb might also display similarly wide variants: first person singular might thus be bhave, bhaveyyaṃ or bhaveyyāmi.… … … …