Make a modification of the previous program, use the C standard library, remove the class written, and it is a bit.
/ * * File Name: Syntax Analysis. H * Summary: Analysis Table and String of Any Enter LL (1) Grammar, this program can automatically determine whether the string is * No is the sentence of this gram, and can give Analysis process. * Current version: 1.2 * Author: happyjyr * Completion Date: 2004.6.8 * Modification Date: 2004.7.24 ** /
#include
Using namespace std;
Void showstack (stack w) // Analysis Stack top element and the first element of the remaining input string compare {cout << "<< << << <<" << "<< Endl; J ; w = str [J]; GOTO OPT1 Else error ();} else {if (x == '#') {if (x == w) {cout << "" << "accept!" << endl << endl;} else Error );} Else {p = location (x, vn); q = location (w, vt); String S1 ("null"), S2 ("null"); if (m [p] [q] == S1 || M [P] [q] == S2) / / Find the generated error () in the two-dimensional array (); else {string str000 = m [p] [q]; cout << "<< x << "->" << STR0 << Endl; // Displays the corresponding generated IF (STR0 == "$") GOTO OPT1; Else {length = str0.size (); // Reversible Inn for (m = Length-1; m> = 0; m -) {st.push (STR0 [M]);} goto OPT1;}}}}} main ()}}} main ()}}} main ()}}} main ()}}} main ()}}} main ()}}} main ()}}} ], Vt [100], select; string m [100] [100]; cout << "* file name: syntax analysis" << Endl; cout << "* Summary: Analysis table and string of any input LL (1) text method, this program can automatically determine that the string is" << endl; cout << "* No is the grafting method Sentence and can give the analysis process.