1 import lexer.*; 2 import lexer.exceptions.*; 3 import java.util.*; 4 5 class TestExpTree { 6 public static void main(String args[]) throws Exception { 7 8 String parseString = "(ab)|c*"; 11 System.out.println("Parse String: "+parseString); 12 try { 13 ExpList el = new ExpList(parseString); 14 System.out.println("List: "+el); 15 16 ExpTree et = new ExpTree(el); 17 System.out.print("Tree: "); 18 Iterator it = et.preIterator(); 19 while (it.hasNext()) { 20 System.out.print(it.next()); 21 } 22 System.out.println(); 23 24 RTS r = new RTS(et); 25 r.print(); 26 27 DFA d = new DFA(r); 28 d.print(); 29 30 59 60 } catch (ExpParseError e) { 61 e.printStackTrace(); 62 System.err.println(parseString); 63 System.err.println(e.emphasize()); 64 System.exit(-1); 65 } 66 } 67 } 68 | Popular Tags |