make code look better
[cdsspec-compiler.git] / run-javacc.sh
index a8484bd..fa9bdad 100755 (executable)
@@ -6,17 +6,23 @@ fi
 
 JAVACC_PATH=$SPEC_COMPILER_HOME/lib
 
-OUTPUT_PATH=$SPEC_COMPILER_HOME/src/edu/uci/eecs/specCompiler/grammerParser
-mkdir -p $OUTPUT_PATH
+PRE_SCANNER_FILE=$SPEC_COMPILER_HOME/grammer/pre_scanner.jj
+GRAMMER_FILE=$SPEC_COMPILER_HOME/grammer/spec_compiler.jj
+UTIL_FILE=$SPEC_COMPILER_HOME/grammer/util.jj
 
-GRAMMER_FILE=$SPEC_COMPILER_HOME/grammer/spec-compiler.jj
-
-if [ -z $1 ]; then
-       echo "Using the default grammer file: $GRAMMER_FILE."
-else
-       GRAMMER_FILE=$1
-fi
+PRE_SCANNER_OUTPUT_PATH=$SPEC_COMPILER_HOME/src/edu/uci/eecs/specCompiler/grammerParser/preScanner
+GRAMMER_OUTPUT_PATH=$SPEC_COMPILER_HOME/src/edu/uci/eecs/specCompiler/grammerParser
+UTIL_OUTPUT_PATH=$SPEC_COMPILER_HOME/src/edu/uci/eecs/specCompiler/grammerParser/utilParser
 
 echo "Deleting the old generated java files."
-rm $OUTPUT_PATH/*.java
-java -cp $JAVACC_PATH/javacc.jar javacc -OUTPUT_DIRECTORY=$OUTPUT_PATH $GRAMMER_FILE
+rm -r $PRE_SCANNER_OUTPUT_PATH/*
+rm -r $GRAMMER_OUTPUT_PATH/*
+rm -r $UTIL_OUTPUT_PATH/*
+
+mkdir -p $PRE_SCANNER_OUTPUT_PATH
+mkdir -p $GRAMMER_OUTPUT_PATH
+mkdir -p $UTIL_OUTPUT_PATH
+
+java -cp $JAVACC_PATH/javacc.jar javacc -OUTPUT_DIRECTORY=$PRE_SCANNER_OUTPUT_PATH $PRE_SCANNER_FILE
+java -cp $JAVACC_PATH/javacc.jar javacc -OUTPUT_DIRECTORY=$GRAMMER_OUTPUT_PATH $GRAMMER_FILE
+java -cp $JAVACC_PATH/javacc.jar javacc -OUTPUT_DIRECTORY=$UTIL_OUTPUT_PATH $UTIL_FILE