package Calc; import java_cup.runtime.*; import Calc.*; import Calc.Absyn.*; import java.io.*; public class Interpret { public static void main(String args[]) throws Exception { Yylex l = new Yylex(System.in); parser p = new parser(l) ; Calc.Absyn.Exp parse_tree = p.pExp() ; System.out.println(Interpreter.interpret(parse_tree)) ; } } /* public class Interpret { public static void main(String args[]) throws Exception { Yylex l = null; parser p; try { if (args.length == 0) l = new Yylex(System.in); else l = new Yylex(new FileReader(args[0])); } catch(FileNotFoundException e) { System.err.println("Error: File not found: " + args[0]); System.exit(1); } p = new parser(l); // /* The default parser is the first-defined entry point. * / // You may want to change this. Other options are: * / try { Calc.Absyn.Exp parse_tree = p.pExp(); System.out.println(); System.out.println(Interpreter.interpret(parse_tree)); } catch(Throwable e) { System.err.println("At line " + String.valueOf(l.line_num()) + ", near \"" + l.buff() + "\" :"); System.err.println(" " + e.getMessage()); System.exit(1); } } } */