import java.io.File;

public class CalculatorMain
{
  public static void main (String args[])
    {
      try
        {
          CalculatorTokenizer t;
          
          if(args.length>0)
            t = new CalculatorTokenizer(new File(args[0]));
          else
            t = new CalculatorTokenizer();

          try
            { // arg to parse is to enable building the parse tree
              // - COMPACT_TREE for the trimmed version
              CalculatorParser p = new CalculatorParser(t);
              p.parse(p.COMPACT_TREE);
            }
          catch (Exception e)
            {
              System.out.println("*** Parsing error: "+e);
            }
        }
      catch (Exception e)
        {
          System.out.println("*** Tokenizing error: "+e);
        }
    }
}
