// file: analyzeRexp.java // author: Robert Keller // // purpose: Showing how single R expressions can be read, then analyzed // using package polya // // action: Repeatedly reads single R expressions and analyzes them // // run: javac analyzeRexp.java; java analyzeRexp import polya.*; class analyzeRexp { static String promptString = "analyze Rexp: "; // default prompt public static void main(String arg[]) { Tokenizer in = new Tokenizer(System.in); // R exp tokenizer Object ob; // the object to be analyzed while( true ) { System.out.print(promptString); // prompt for input ob = in.nextRexp(); // read object as R expression if( ob == Tokenizer.eof ) break; // break on end-of-file System.out.println(Polylist.analysis(ob)); // show analysis } System.out.println(); // new line when program ends } }