home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_BAS / PRO98SRC.ZIP / COMPILER.BAS < prev    next >
BASIC Source File  |  1994-01-16  |  2KB  |  73 lines

  1. COMPILER:
  2. prozoprint crlf$+crlf$+"^0^BThe PROZOL Compiler"+CrLf$+CrLf$
  3. c$=ltrim$(rtrim$(mid$(commandline$,2)))
  4. if instr(commandline$," ")=0 then goto huh
  5. ex$=left$(c$,instr(c$," ")-1)
  6. ' PROZOL -PRX file(s)
  7. c$=mid$(c$,instr(c$," ")+1)
  8. getfilespec:
  9. if instr(c$," ") then
  10.     f$=left$(c$,instr(c$," ")-1):c$=mid$(c$,instr(c$," ")+1)
  11. else
  12.     f$=c$:c$=""
  13. end if
  14. a$=dir$(f$)
  15. if a$="" then prozoprint chr$(7)+f$+" - not found!" + CrLf$
  16. do until a$=""
  17.     ' clear memory
  18.     NextVar%=1
  19.     ERASE VAR$()
  20.     ERASE VALUE$()
  21.     Fi%=FREEFILE
  22.     OPEN A$ FOR INPUT AS #Fi%
  23.         PROZOPRINT A$ + " - "
  24.     x%=UBOUND(PROGRAM$)
  25.     REDIM PROGRAM$(x%)
  26.     LINE INPUT #Fi%,P$
  27.         IF LEFT$(P$,3)="PRZ" THEN
  28.                 ' it's a compiled program
  29.             PROZOPRINT P$+" This program is already compiled."+CrLf$+CHR$(7)
  30.                 close #fi%
  31.         a$=dir$
  32.                 iterate do
  33.     END IF
  34.     PROGRAM$(1)=P$
  35.     MaxLine%=2
  36.     DO UNTIL EOF(Fi%)
  37.             LINE INPUT #Fi%, PROGRAM$(MaxLine%)
  38.                 IF RIGHT$(PROGRAM$(MaxLine%),1)="_" THEN
  39.                     DO UNTIL EOF(Fi%) OR RIGHT$(PROGRAM$(MaxLine%),1)<>"_"
  40.                             LINE INPUT #Fi%,Aa$
  41.                                 PROGRAM$(MaxLine%)=PROGRAM$(MaxLine%)+Aa$
  42.                         LOOP
  43.                 END IF
  44.                 IF INSTR(PROGRAM$(MaxLine%),"{") THEN
  45.                     DO UNTIL EOF(Fi%) OR INSTR(PROGRAM$(MaxLine%),"}")
  46.                             LINE INPUT #Fi%,Aa$
  47.                             PROGRAM$(MaxLine%)=PROGRAM$(MaxLine%)+CHR$(13,10)+Aa$
  48.                         LOOP
  49.         END IF
  50.         INCR MaxLine%
  51.         LOOP
  52.         CLOSE #Fi%
  53.         IF instr(a$,".")=0 then
  54.             a$=a$+"."+ex$
  55.     else
  56.             a$=left$(a$,instr(a$,"."))+ex$
  57.     end if
  58.  
  59.         prxsavearray a$,program$()
  60.         prozoprint a$ + CrLf$
  61.         a$=dir$
  62. loop
  63.  
  64. if c$="" then end
  65. goto getfilespec
  66.  
  67. huh:
  68.  
  69. prozoprint CrLf$+CrLf$+"^0^BCompiler syntax:   PROZOL -ext filespec [filespec...]"+Crlf$+Crlf$
  70. prozoprint "Where 'ext' is the extension you want to give your compiled programs, and"+CrLf$
  71. prozoprint "the filespec is any file name, wild card specification, or list of files"+CrLf$
  72. prozoprint "separated by spaces.^0"+CrLf$
  73. end