1 2 23 24 25 26 class SPL { 27 28 public static void main(String args[]) { 29 SPLParser parser; 30 if (args.length == 1) { 31 System.out.println("Stupid Programming Language Interpreter Version 0.1: Reading from file " + args[0] + " . . ."); 32 try { 33 parser = new SPLParser(new java.io.FileInputStream (args[0])); 34 } catch (java.io.FileNotFoundException e) { 35 System.out.println("Stupid Programming Language Interpreter Version 0.1: File " + args[0] + " not found."); 36 return; 37 } 38 } else { 39 System.out.println("Stupid Programming Language Interpreter Version 0.1: Usage :"); 40 System.out.println(" java SPL inputfile"); 41 return; 42 } 43 try { 44 parser.CompilationUnit(); 45 parser.jjtree.rootNode().interpret(); 46 } catch (ParseException e) { 47 System.out.println("Stupid Programming Language Interpreter Version 0.1: Encountered errors during parse."); 48 e.printStackTrace(); 49 } catch (Exception e1) { 50 System.out.println("Stupid Programming Language Interpreter Version 0.1: Encountered errors during interpretation/tree building."); 51 e1.printStackTrace(); 52 } 53 } 54 } 55 | Popular Tags |