#! /bin/csh ########################################################################### # PROJECT: DEMETER # MODULE: GENERATION OF EXECUTABLE PARSER # FILE: parse-generate # SYSTEM: UNIX 4.3 BSD on sun #-------------------------------------------------------------------------- # COPYRIGHT (c) 1990 Northeastern University # Prof. Karl J. Lieberherr #-------------------------------------------------------------------------- # AUTHOR: Ignacio Silva-Lepe # # DATE: March 16, 1991 # REVISED: June 12, 1991 # - Added -lchecker # - Adapted to new directory structure # July 3, 1991 Walter Hursch # - cd-parse/print-new ==> cd-parse/print-old # #-------------------------------------------------------------------------- # DESCRIPTION: # This script file generates: # - A scanner directory. # - A main.C file # - An executable file # To run the generic parser without the need to generate a whole # environment. # ########################################################################### $DEMETER/bin/version echo " *** GENERATION ***" echo "" set CONCAT = ($DEMETER/fixed/concat) set COPY = ($DEMETER/fixed/copy) set CURRCPU = `get-cpu` # unalias rm, mv and cp alias rm rm alias mv mv alias cp cp echo "*** Creating directories ***" if (! -d U-1) mkdir U-1 if (! -d STATISTICS) mkdir STATISTICS # Statistics # Clean up the mess left in TOP before if (! -d STATISTICS) mkdir STATISTICS echo -n $USER " at " $cwd " started at " >> STATISTICS/parse-generate.log date >> STATISTICS/parse-generate.log foreach STAT (xref.log tree-prop.log sem-check.log) if ( -f $STAT) mv $STAT STATISTICS/$STAT end if (! -d U-1/SCANNER) mkdir U-1/SCANNER if (! -d CDS) mkdir CDS echo "DONE"; echo "" echo "*** Copying stable files ***" cp $COPY/COPYRIGHT . cat $COPY/parse-main-head.C > main.C echo -n 'char* GEN_DIR = "' >> main.C echo -n $cwd/U-1 >> main.C echo '";' >> main.C cat $COPY/parse-main-tail.C >> main.C echo "DONE"; echo "" # generate SCANNER gen-scanner -c cd-parse -t U-1/SCANNER # create lex.yy.c # don't override existing, maybe customized, lex parts in directory SCANNER # make sure a valid lex.yy.c file is in directory SCANNER echo "" echo "*** Generating lex.yy.o ***" cd U-1/SCANNER $ccC -c lex.yy.c cd ../.. echo "DONE"; echo "" echo "*** Moving cd-parse and cd-print ***" if (-f cd-parse) then if (! -f U-1/cd-parse) then cp cd-parse U-1 else mv U-1/cd-parse U-1/cd-parse-old cp cd-parse U-1/cd-parse endif else if (! -f U-1/cd-parse) echo "Warning: parse-generator can't find cd-parse." endif if (-f cd-print) then if (! -f U-1/cd-print) then cp cd-print U-1 else mv U-1/cd-print U-1/cd-print-old cp cd-print U-1/cd-print endif else if (! -f U-1/cd-print) echo "Warning: parse-generator can't find cd-print." endif echo "DONE"; echo "" echo "*** Moving class dictionaries ***" # move all cds except cd-parse and cd-print to CDS mv cd-* CDS echo "DONE"; echo "" echo "*** Compiling ***" $CCC -o U-1/run-parser main.C -L$DEMETER/lib/$CURRCPU U-1/SCANNER/lex.yy.o \ -lexecparser -ll if ( -f main.o) then mv main.o U-1 endif echo "DONE"; echo "" echo "NOTE, usage of executable generic parser:" echo " cd U-1" echo " run-parser demeter-input-file [start-symbol]" end: