/* SCCS - @(#)Pat.java 1.3 - 09/09/99 - 18:54:42 */ /* * Copyright (c) 1997 USC Brain Project. email nsl@java.usc.edu. */ /* NSLJ Pre-Processor * based on Guava * it uses Java to Bison F (JBF). * This inputs to this file get made by JB. * The inputs are: jbf/YYtokentypes.java, YYparse.java, YYlex.java * * $Log: Pat.java,v $ * Revision 1.4 1997/11/06 03:21:46 erhan * NSL3.0.b * * Revision 1.3 1997/07/30 21:10:30 erhan * nsl3.0 * * Revision 1.2 1997/03/28 02:04:30 aalx * modified to include copyright notices to us or the appropriate author. * * Revision 1.1.1.1 1997/03/12 23:09:23 nsl * changed dir struct * * Revision 1.3 1997/02/27 07:07:34 erhan * 1 * * Revision 1.2 1997/02/25 23:37:35 erhan * ok? * * Revision 1.1.1.1 1997/02/20 08:04:35 nsl * Importing npp * */ package patch.src; import java.io.*; import patch.src.util.*; import pp.src.jbf.*; /** NSLJ Pre-Processor * based on JBF. */ public class Pat { public static YYlex yyl = new YYlex(System.in,System.out); public static YYparse yyp = new YYparse(yyl,System.err); // public static Patch p = new Patch(); public static npp.src.util.NslPreProcessor p = new npp.src.util.NslPreProcessor(); /** Main runtime routine - call java Pat to run. */ public static void main(String argv[]) { boolean debuglex = false; boolean debugparse = false; boolean lexonly = false; YYtoken yylval; int llevel = 0; int plevel = 0; System.err.println("NSL pre-processor PHASE 2...."); if (argv.length == 1 && (argv[0].compareTo("-0")==0 || argv[0].compareTo("-h")==0)) { System.out.println("Usage: java Pat [-debug][-debuglex][-debugparse][-lex][-l Lexlevel][-p ParseLevel] .java"); } for(int i=0;i 0) yyl.setdebug(llevel); else yyl.setdebug(true); } if(yyp != null && debugparse) { System.out.println("parse debug turned on"); if(plevel > 0) yyp.setdebug(plevel); else yyp.setdebug(true); } try { if(lexonly) { do { yylval = yyl.yylex(); } while (yylval != null); if(debuglex)System.out.println("lex succeeded"); } else { yyp.yyparse(); // p.genCode(); if(debugparse)System.out.println("parse succeeded"); } } catch (Exception e) { System.err.println("!!! exception detected:" + e.getMessage()); e.printStackTrace(); System.err.println("*** CAN NOT PARSE TMP FILE ! *** \n"); System.exit(0); } // p.endClass(); } }; /*class Pat*/