/*grammar.c v1.9*/ /*This minigrammar will generate nothing more than a verb, a complement of the verb, a complement of the verbal complement, and a complement of that. There is one NP loop, but currently no more. Each head is optionally intransitive depending on the choice of the user. dr. d.*/ #include #include #include #include void initialize(void) { /*#ifdef pc_os #define SIOUX 0 #endif #ifdef mac_os #define SIOUX 1 #endif*/ #if SIOUX #include #endif #if SIOUX SIOUXSettings.setupmenus=FALSE; SIOUXSettings.autocloseonquit=TRUE; SIOUXSettings.asktosaveonclose=FALSE; SIOUXSettings.showstatusline=FALSE; #endif } //void isa_head (char * head) void isa_head(void) #define head (verb || noun || det || P || A || adv) { char verb, noun, det, P, comp, A, noun1, det1, adv, advv; } int main(void) { char verb[256]; char noun[256]; char det[256]; char P[256]; char comp[256]; char A[256]; char noun1[256]; char det1[256]; char adv[256]; char advv[256]; initialize(); /* printf("Enter a verb : head"); // strcpy(base,"write"); printf("-\n"); printf("Is a verb : [V %s ]\n\n",verb);*/ //"[A" advv "]" = adv; cout <<"Enter a verb" <> verb; cout << "[V " <> ans; if (ans == 'N' || ans == 'n') goto vp; else cout <<"Type in the adverb:\n"; cin >> adv; strcpy(advv,adv); strcat("[A ",advv); strcat(advv," ]"); cout << "[A " <> ans; if (ans == 'N' || ans == 'n' ) cout << "[VP [V "<< verb << "]] is a verb phrase. This is as far as she goes."; if (ans == 'n') exit(1); else //np:; cout << "Determine the head of the complement and type it in: " <> noun; cout << "[N " <> ans; if (ans == 'N' || ans == 'n' ) { cout << "[NP [N "<< noun << "]] is a noun phrase.\n"; goto np2; } else { cout << "Enter the determiner." <> det; cout << "[D "<> ans; if (ans == 'N' || ans == 'n' ) { cout << "[VP [V " <> P; cout << "[P " <> ans; if (ans == 'N' || ans == 'n') { cout << "[PP [P " << P << " ]] is an intransitive preposition.\n"; goto esc; } else //goto np; //embedded NP { cout << "Please enter the head of the complement of '"<> noun1; cout << "[N " << noun1 << " ] is a noun."<> ans; if (ans == 'N' || ans == 'n') { cout << "[NP [NP "<> det1; cout << "[NP [D "<