I have spent a lot of time programming grammar. There are certainly rules to be found that follow certain logics and consistency, but there also exist exceptions to each and every one of them. Grammar is really just a form, a guideline of courtesy. Contrary to what I was taught in school, English does not strictly follow the subject-verb-object order. Sherlock Holmes would make verb-subject-object statements "Have you your gun?", and even relative clauses like "the program (that) I made" are object-subject-verb order, never mind even Yoda. I found out fairly early on that grammar rules only get you so far (let's say 60% of the way to understanding). It's not bad but not sufficient. After that it's semantics, which also feature rules, as well as exceptions like expressions and idioms whose origins are long forgotten. Even if we just look at spelling rules or pronunciation (which for some senseless reason is not written pronOUnciation), there is no consistency because English is a mix of Latin, Greek, Old English, and French.
People used to program AI with context-free grammar, which could only process full and properly written sentences. I do not find this an unreasonable approach in principle, it does allow one to communicate intelligently with AI, it just requires more effort of humans and can't be applied to e.g. social media where the money is at. At the other extreme, people try to "train" AI on text with no hint of rules. This produces the nonsense poetry and ungrammatical strings of text that we've seen the last decade. It can guess a fair way but is only as reliable as a statistical average: Most of the time, it's right, but some of the time, it's completely bonkers.
I believe there are basic rules, I also believe that language changes. I do not believe that one can program every (new) exception to the rules, nor do I believe that a program can learn language without giving it any handles. I choose to program the main rules, and then use learning mechanisms to learn the exceptions to them. If and when language evolves beyond recognition, computers won't be running Windows programs anymore anyway.