Grammatical rules and software security