home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / jikepg12.zip / jikespg / examples / expr / Main.java < prev    next >
Encoding:
Java Source  |  1999-11-04  |  1.1 KB  |  36 lines

  1. // $Id: Main.java,v 1.3 1999/11/04 14:02:18 shields Exp $
  2. // This software is subject to the terms of the IBM Jikes Compiler
  3. // License Agreement available at the following URL:
  4. // http://www.ibm.com/research/jikes.
  5. // Copyright (C) 1983, 1999, International Business Machines Corporation
  6. // and others.  All Rights Reserved.
  7. // You must accept the terms of that agreement to use this software.
  8.  
  9. public class Main
  10. {
  11.     public static void main(String[] args) throws java.io.IOException, java.io.FileNotFoundException
  12.     {
  13.         Option option = new Option(args);
  14.  
  15.         while (true)
  16.         {
  17.             System.out.print("Expression: ");
  18.  
  19.             LexStream lex_stream = new LexStream();
  20.             Scanner scanner = new Scanner(option, lex_stream);
  21.             scanner.scan();
  22.  
  23.             if (option.dump)
  24.                 lex_stream.dump();
  25.  
  26.             Parser parser = new Parser(lex_stream);
  27.             Ast root = parser.parse();
  28.             if (root != null)
  29.                  System.out.println("    " + root.toString(lex_stream) + " = " + root.Value());
  30.             else break;
  31.         }
  32.  
  33.         return;
  34.     }
  35. }
  36.