Write a program that checks if a sentence is correct according to the  English grammar in 6.4.1. Assume that every sentence is terminated  by a full stop (.) surrounded by whitespace. For example, birds fly  but the fish swim . is a sentence, but birds fly but the fish swim  (terminating dot missing) and birds fly but the fish swim. (no space  before dot) are not. For each sentence entered, the program should  simply respond OK or not OK. Hint: Dont bother with tokens; just  read into a string using >>.#include <string>#include <iostream>using namespace std;string str;void putback(string s) {    str = s;}string verb() {    if (str == rules || str == fly || str == swim) {        return str + ' ';    }    else         return ;}string noun() {    if (str == birds || str == fish || str == C++) {        return str + ' ';    }    else         return ;}string article() {    if (str == the) {        string temp = str;        cin >> str;        return temp + ' ';    }    else         return ;}string conjunction() {    if (str == and || str == or || str == but) {        return str + ' ';    }    else         return ;}string l;string sentence() {    l += article();    if (noun() == ) {        cerr << NOT OK;        return ;    }    else {        l += noun();        cin >> str;        string temp = verb();        if (temp == ) {            cerr << NOT OK;            return ;        }        else {            l += temp;            cin >> str;            if (str == ) {                cerr << NOT OK;                return  ;            }            else if (str == .) {                l += .;                return l;            }            else {                if(conjunction() == ) {                    cerr << NOT OK;                }                else {                    l += str + ' ';                    cin >> str;                }                return sentence();            }        }    }}int main() try {    string sen =  ;    while (cin) {        cin >> str;        sen = sentence();        if (str == .) {            cout << sen << '\n';        }    }    //keep_window_open();}catch (exception& e) {    cerr << error:  << e.what() << '\n';    //keep_window_open();    return 1;}catch (...) {    cerr << Oops: unknown exception!\n;    //keep_window_open();    return 2;}The Grammar:Sentence:          Noun Verb                                   // e.g., C++ rules          Article Noun Verb          Sentence Conjunction Sentence   // e.g., Birds fly but fish swimConjunction:          and          or          butArticle:          theNoun:          birds          fish          C++Verb:          rules          fly          swimThis is perfectly working code. Is there anything I can improve on for my code? Do you think using global variables in this case is okay? Even for whether I have proper variable names is worth commenting. This question is from this webpage, exercise 6 at the very bottom.
Checking proper English sentences of user's input with grammar using C++
c++;grammar