`PartialCalculator.java`

    import ilog.language.syntax.GenericParser;

    public class PartialCalculator
    {
      public static void main (String args[])
        {
          try
            {
              CalculatorTokenizer t;

              t = new CalculatorTokenizer("");

              try
                {
                  CalculatorParser p = new CalculatorParser(t);

                  String input;

                  p.parseTreeType = p.COMPACT_TREE;
    //            p.toggleTrace();

                  System.out.println("\n---------------------------------------------\n");

                  p.parseExpression(input="1+2");
                  System.out.println("\nvalue() of "+input+" is "+p.currentNode().nvalue());
                  System.out.println("\nPARSE TREE:\n");
                  p.currentNode().show();

                  System.out.println("\n---------------------------------------------\n");

                  p.parseDefinition("pi = 22/7");
                  System.out.println("\nDefining pi as "+p.currentNode().nvalue());
                  System.out.println("\nPARSE TREE:\n");
                  p.currentNode().show();

                  System.out.println("\n---------------------------------------------\n");

                  p.parseExpression("2 * pi");
                  System.out.println("\nTwice this pi is "+p.currentNode().nvalue());
                  System.out.println("\nPARSE TREE:\n");
                  p.currentNode().show();

                  System.out.println("\n---------------------------------------------\n");
                }
              catch (Exception e)
                {
                  System.out.println("*** Parsing error: "+e);
                }
            }
          catch (Exception e)
            {
              System.out.println("*** Tokenizing error: "+e);
            }
        }
    }

This file was generated on Mon Dec 20 19:03:12 PST 2004 from file `PartialCalculator.java`
by the `ilog.language.tools.Hilite` Java tool written by Hassan Aït-Kaci