home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / rascal.arc / RASCAL.DOC < prev    next >
Encoding:
Text File  |  1980-01-01  |  27.9 KB  |  901 lines

  1.  
  2.  
  3.  
  4.  
  5.                                   November 1983
  6.  
  7.         This  document  tells  how  to  use the Rascal BASIC preprocessor
  8.         program,  RASCAL.EXE, and tells how to write programs for the IBM
  9.         PC  in  the Rascal language. This manual assumes you are familiar
  10.         with MS DOS and Microsoft BASIC.
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.                               RASCAL USER'S MANUAL
  25.  
  26.                               RASCAL USER'S MANUAL
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.                              Manual version:   1.05
  34.  
  35.                              Software version: 1.05
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.                                    Marty Franz
  52.  
  53.                      525 W. Walnut St., Kalamazoo, MI 49007
  54.  
  55.                                  (616) 344-1821
  56.  
  57.  
  58.  
  59.                (C) Copyright 1983 Marty Franz - All rights reserved
  60.  
  61.  
  62.  
  63.         111483105
  64.         Rascal Preprocessor User's Manual
  65.  
  66.  
  67.  
  68.         INTRODUCTION
  69.  
  70.         INTRODUCTION
  71.  
  72.             RASCAL.EXE is a preprocessor program for Microsoft BASIC on
  73.         the IBM PC.  It takes a program containing special Rascal
  74.         statements and translates it into a program containing BASIC
  75.         statements.  Using Rascal helps you write more concise, better
  76.         structured BASIC programs, because the preprocessor lets you take
  77.         advantage of these features:
  78.  
  79.             - you now have the ability to write free-form, indented
  80.               statements without line numbers.
  81.  
  82.             - you can now include statements from many separate files
  83.               into a single BASIC program. This lets you write and
  84.               maintain your programs in small modules.
  85.  
  86.             - you can organize your subroutines into procedures, each
  87.               with its own alphanumeric name.
  88.  
  89.             - you can use structured programming statements similar to
  90.               those found in programming languages like Pascal and C.
  91.  
  92.             Before using RASCAL.EXE, please take the time to read these
  93.         instructions carefully.  When using it, bear in mind that this is
  94.         version 1.05 of the program, and there may be bugs in it.  If
  95.         there is, or you have suggestions on improving Rascal, please
  96.         contact me:
  97.  
  98.                  Marty Franz
  99.                  525 W. Walnut St.
  100.                  Kalamazoo, MI  49007
  101.                  (616) 344-1821
  102.  
  103.             One more thing: the program, and this manual, are copyrighted
  104.         materials.  They may be freely distributed only for private,
  105.         noncommercial use.  Please read the copyright notice on your
  106.         diskette.
  107.  
  108.  
  109.         A SAMPLE PROGRAM
  110.  
  111.         A SAMPLE PROGRAM
  112.  
  113.             Before describing Rascal in too much detail, let's first look
  114.         at a typical program.  This will help you understand what
  115.         RASCAL.EXE does.  The file LC.RAS on the Rascal diskette is a
  116.         good example.  It asks for the name of a text file and counts the
  117.         number of lines in it.  You can make a listing of LC.RAS on your
  118.         printer with the PRINT program supplied on the diskette:
  119.  
  120.                  A>llist lc.ras
  121.  
  122.         (See the LLIST program instructions for more information on the
  123.         LLIST program.)
  124.  
  125.  
  126.  
  127.  
  128.                                                                          Page 2
  129.         111483105
  130.         Rascal Preprocessor User's Manual
  131.  
  132.  
  133.  
  134.             Your listing of LC.RAS should look like this:
  135.  
  136.             'Sample Rascal program to count the lines in an ASCII file.
  137.  
  138.             PROCEDURE MAIN
  139.                  ON ERROR GOTO CHECK.FOR.EOF
  140.  
  141.                  INPUT "File Name"; FILE.NAME$
  142.                  OPEN FILE.NAME$ FOR INPUT AS #1
  143.                  LINE.COUNT = 0 : DONE.SW = 0
  144.                  REPEAT
  145.                       LINE INPUT #1, L$
  146.                       LINE.COUNT = LINE.COUNT+1
  147.                  UNTIL DONE.SW = 1
  148.                  PRINT "There are";LINE.COUNT-1;"lines in ";FILE.NAME$
  149.             ENDPROC
  150.  
  151.             CHECK.FOR.EOF|
  152.                  ERROR.CODE = ERR : ERROR.LINE = ERL
  153.                  IF ERROR.CODE = 62
  154.                       DONE.SW = 1
  155.                       RESUME NEXT
  156.                  ELSE
  157.                       PRINT "BASIC error ";ERROR.CODE;"at";ERROR.LINE
  158.                       STOP 'Immediately halt program
  159.                  ENDIF
  160.             END
  161.  
  162.             This file (called a source file in this manual) was created
  163.  
  164.                                 ______ ____
  165.         using the RED.EXE program.  For more information about RED, see
  166.         the separate file about it on the diskette.  Don't worry at this
  167.         point about the details of each statement in the program; we'll
  168.         be covering them shortly.  For now, notice only that a Rascal
  169.         program, unlike a BASIC program, has line-number-free, neatly
  170.         indented statements, and empty lines to separate blocks of
  171.         statements. In fact, it resembles those Pascal programs you've
  172.         seen in magazines more than BASIC.  Because the program looks
  173.         more structured than BASIC, it ought to be easier to understand
  174.         and maintain.
  175.  
  176.             Unfortunately, this program cannot be executed directly by
  177.         BASIC.  We need to convert this program into one with everyday
  178.         BASIC statements in it before we can run it.  This is what
  179.         RASCAL.EXE does.  To build a BASIC program out of LC.RAS, we
  180.         enter:
  181.  
  182.                  A>rascal lc.ras lc.bas
  183.  
  184.         and these messages appear:
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.                                                                          Page 3
  193.         111483105
  194.         Rascal Preprocessor User's Manual
  195.  
  196.  
  197.  
  198.                  Rascal BASIC preprocessor, version 1.05
  199.                  (C) Copyright 1983 Marty Franz
  200.  
  201.                  60KB to spare
  202.                  Done with pass 2, 0 error(s) found.
  203.                  22 lines processed,  147 lines/minute.
  204.  
  205.                  A>
  206.  
  207.             After the RASCAL.EXE is done, if we then type the output
  208.         file, LC.BAS, we see:
  209.  
  210.             A>type lc.bas
  211.  
  212.              10  'LC.RAS  10-14-83   5:48a  22 lines
  213.              20  GOSUB 50
  214.              30  END
  215.              40  'Sample Rascal program to count the lines in an ASCII
  216.                  file
  217.              50  'PROCEDURE MAIN
  218.              60  ON ERROR GOTO 150
  219.              70  INPUT "File Name"; FILE.NAME$
  220.              80  OPEN FILE.NAME$ FOR INPUT AS #1
  221.              90  LINE.COUNT = 0 : DONE.SW = 0
  222.             100  LINE INPUT #1, L$
  223.             110  LINE.COUNT = LINE.COUNT+1
  224.             120  IF NOT(DONE.SW = 1) THEN 100
  225.             130  PRINT "There are";LINE.COUNT-1;"lines in ";FILE.NAME$
  226.             140  RETURN
  227.             150  'CHECK.FOR.EOF|
  228.             160  ERROR.CODE = ERR : ERROR.LINE = ERL
  229.             170  IF NOT(ERROR.CODE = 62) THEN 210
  230.             180  DONE.SW = 1
  231.             190  RESUME NEXT
  232.             200  GOTO 230
  233.             210  PRINT "BASIC error ";ERROR.CODE;"at";ERROR.LINE
  234.             220  STOP 'Immediately halt program
  235.             230  END
  236.  
  237.             A>
  238.  
  239.         This is a conventional BASIC program that can now be run using
  240.  
  241.         ____
  242.         BASIC or BASICA.
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.                                                                          Page 4
  257.         111483105
  258.         Rascal Preprocessor User's Manual
  259.  
  260.  
  261.  
  262.             To summarize our example, which demonstrated the process of
  263.         creating a Rascal program:
  264.  
  265.             1. We first use a text editor to write the program. The
  266.                program contains special Rascal statements (which we'll
  267.                cover soon), is free of line numbers, has lots of blank
  268.                lines and indenting, and is easier to read and maintain
  269.                than regular BASIC.
  270.  
  271.             2. We then use the Rascal preprocessor program, RASCAL.EXE,
  272.                to translate the Rascal program into one with everyday
  273.                BASIC statements in it.
  274.  
  275.             3. The translated BASIC program is now run and debugged as
  276.                usual from BASIC.
  277.  
  278.  
  279.  
  280.         PROGRAM REQUIREMENTS
  281.  
  282.         PROGRAM REQUIREMENTS
  283.  
  284.             To preprocess Rascal programs, you need an IBM PC or XT
  285.         with:
  286.  
  287.             - at least 64KB of memory,
  288.  
  289.             - at least one single-sided diskette drive,
  290.  
  291.             - a color or monochrome adapter, with a monitor capable of
  292.               displaying 80-character lines.
  293.  
  294.             - MS DOS version 1.1 or 2.0, and
  295.  
  296.             - BASIC.COM or BASICA.COM
  297.  
  298.         You also need the files:
  299.  
  300.                  RASCAL.EXE
  301.                  RAS.BAT
  302.  
  303.         available on the diskette with BASIC or BASICA.
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.                                                                          Page 5
  321.         111483105
  322.         Rascal Preprocessor User's Manual
  323.  
  324.  
  325.  
  326.         THE RAS.BAT FILE
  327.  
  328.         THE RAS.BAT FILE
  329.  
  330.             The file RAS.BAT has been included to make processing Rascal
  331.         source files easier.  Instead of using RASCAL.EXE and completely
  332.         specifying the input and output file names, RAS.BAT gives you a
  333.         command called RAS that assumes a .RAS extension on the Rascal
  334.         program's filename and a .BAS extension on the output BASIC
  335.         filename.  The format of the RAS command is simply:
  336.  
  337.                  A>ras {filename}
  338.  
  339.         The word "filename" in { }s means you have to supply your
  340.         filename (without specifying the extension) for the command to
  341.         work properly.  To preprocess the file LC.RAS, for example, we'd
  342.         use:
  343.  
  344.                  A>ras lc
  345.  
  346.         Now that we've covered how to preprocess Rascal programs, let's
  347.         delve into how to write them.
  348.  
  349.  
  350.  
  351.         RASCAL STATEMENTS
  352.  
  353.         RASCAL STATEMENTS
  354.  
  355.             Your Rascal source program is composed of Rascal statements.
  356.         A Rascal statement is  similar to a BASIC statement, except the
  357.         line number is missing: Rascal supplies this for you when it
  358.         builds the BASIC program from your Rascal program.  If
  359.  
  360.                  10 PRINT "Hello, world"
  361.  
  362.         is a BASIC statement, then
  363.  
  364.                  PRINT "Hello, world"
  365.  
  366.         is the matching Rascal statement.  Only the line number is
  367.         missing.  You can have any number of blanks and tab characters
  368.         in your Rascal statements.  In fact, this is encouraged since
  369.         this helps make your Rascal programs easier to read.
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.                                                                          Page 6
  387.         111483105
  388.         Rascal Preprocessor User's Manual
  389.  
  390.  
  391.  
  392.  
  393.         LABELS
  394.  
  395.         LABELS
  396.  
  397.             Without line numbers in front of statements, you need another
  398.         way to mark the places in a program where control is to go during
  399.         its execution.  You can do this in Rascal with alphanumeric
  400.         labels instead of line numbers. In a BASIC program, we might
  401.         write two statements as:
  402.  
  403.                  960 GOTO 1030
  404.  
  405.         and
  406.  
  407.                  1030 STOP 'End the program
  408.  
  409.         In Rascal, these two statements would be written instead as:
  410.  
  411.                  GOTO THE.END
  412.  
  413.         and
  414.  
  415.                  THE.END| STOP
  416.  
  417.             Labels can be from 1 to 32 characters in length.  Only the
  418.         characters 0-9, A-Z, a-z, and "." (period) can be in a label.
  419.         This is to keep labels from conflicting from other BASIC
  420.         keywords.  The "|" (vertical bar) is used only where the label is
  421.         defined; notice that it's not there in the GOTO statement.  It's
  422.         used to set the label off from the rest of the line.
  423.  
  424.             Another example of labels in a Rascal program is in LC.RAS.
  425.         The statements:
  426.  
  427.                  ON ERROR GOTO CHECK.FOR.EOF
  428.  
  429.         and
  430.  
  431.                  CHECK.FOR.EOF|
  432.  
  433.         also demonstrate how labels are referenced (the ON GOTO
  434.         statement) and defined (the CHECK.FOR.EOF| statement) in Rascal.
  435.  
  436.         The Rascal statements that can use labels are:
  437.  
  438.                  ON ERROR GOTO {label}
  439.                  ON n GOTO {label1},{label2},...
  440.                  RESTORE {label}
  441.                  RESUME {label}
  442.                  RETURN {label}
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.                                                                          Page 7
  451.         111483105
  452.         Rascal Preprocessor User's Manual
  453.  
  454.  
  455.  
  456.         PROCEDURES
  457.  
  458.         PROCEDURES
  459.  
  460.             Rascal provides procedures to help organize your programs.
  461.         Procedures are similar to BASIC subroutines, except they are
  462.         identified by and called with an alphanumeric name. Procedures in
  463.         Rascal look like this:
  464.  
  465.                  PROCEDURE {procname}
  466.  
  467.                  ____
  468.                       statements making up the procedure
  469.                  ENDPROC
  470.  
  471.                  ____
  472.  
  473.         (You don't have to spell out the word PROCEDURE; PROC will do, as
  474.         will ENDP for ENDPROC.  In this manual, the underlines show which
  475.         part is required.)  To GOSUB to a procedure you can use either:
  476.  
  477.                  GOSUB {procname}
  478.  
  479.                  ____
  480.  
  481.         or
  482.  
  483.                  DO {procname}
  484.  
  485.                  __
  486.  
  487.         with the rules for procedure names being the same as for label
  488.         names.
  489.  
  490.         The other Rascal statements that can call procedures are:
  491.  
  492.                  ON n DO {procname1},{procname2},...
  493.                  ON COM(n) DO {procname}
  494.                  ON KEY(n) DO {procname}
  495.                  ON PEN DO {name}
  496.                  ON PLAY(n) DO {procname}
  497.                  ON STRIG(n) DO {procname}
  498.                  ON TIMER(n) DO {procname}
  499.  
  500.             Every Rascal program requires at least one procedure, called
  501.         MAIN.  Control is always given to MAIN with a GOSUB when the
  502.         program is started (see lines 10-50 of LC.BAS).  So, our "Hello,
  503.         world" example needs three statements to work properly:
  504.  
  505.                  PROCEDURE MAIN
  506.                       PRINT "Hello, world"
  507.                  ENDPROC
  508.  
  509.             Like white space, you should liberally use procedures in your
  510.         Rascal programs.  They help break your program into mind-size
  511.         chunks for better organization.  Even a single statement deserves
  512.         its own procedure if doing so will make the program easier to
  513.         read.
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.                                                                          Page 8
  523.         111483105
  524.         Rascal Preprocessor User's Manual
  525.  
  526.  
  527.  
  528.         IF BLOCKS
  529.  
  530.         IF BLOCKS
  531.  
  532.             The only place in your Rascal programs where you can't freely
  533.         use a label to stand for a line number is in an IF statement.
  534.         Instead, a special form of IF is used in Rascal, called an "IF
  535.         block".  It looks like this:
  536.  
  537.                  IF {condition}
  538.  
  539.                  __
  540.                       statements executed if {condition} is true
  541.                  ELSE
  542.  
  543.                  ____
  544.                       statements executed if {condition} is false
  545.                  ENDIF
  546.  
  547.                  ____
  548.  
  549.         An example of an IF block is in LC.RAS:
  550.  
  551.                  IF ERROR.CODE = 62
  552.                       DONE.SW = 1
  553.                       RESUME NEXT
  554.                  ELSE
  555.                       PRINT "BASIC error ";ERROR.CODE;"at";ERROR.LINE
  556.                       STOP 'Immediately halt program
  557.                  ENDIF
  558.  
  559.         Briefly, IF the variable ERROR.CODE has the value 62 then the
  560.         statements DONE.SW = 1 and RESUME NEXT will be executed.  This
  561.         will occur if we have reached the end of the file we are reading.
  562.         If ERROR.CODE is not 62, then another, more sinister BASIC error
  563.         has occurred that we don't know how to handle.  The statements
  564.         after the ELSE display the error code and line number and stop
  565.         the program.
  566.  
  567.             Why should you use IF blocks in a Rascal program instead of
  568.         BASIC's IF {condition} THEN {line number} statement?  Because the
  569.         IF block gives you the advantage of always knowing exactly where
  570.         control begins and ends: with no GOTO statements in the IF and
  571.         ELSE parts of the block, execution beginning at the IF statement
  572.         will always resume after the ENDIF statement, regardless of what
  573.         happens in between.  With BASIC's IF statement, you can picture
  574.         control splitting into two separate paths with each THEN.  Pretty
  575.         soon, as patches and revisions are made, your program becomes a
  576.         mess of "spaghetti code".
  577.  
  578.             If you faithfully use the IF block for your program's logic
  579.         you should seldom find the need for a GOTO statement.  GOTOs
  580.         should be saved only for unusual conditions that require special
  581.         processing, such as errors.
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                                                                          Page 9
  593.         111483105
  594.         Rascal Preprocessor User's Manual
  595.  
  596.  
  597.  
  598.         REPEAT AND WHILE BLOCKS
  599.  
  600.         REPEAT AND WHILE BLOCKS
  601.  
  602.             Right now, many of your program loops in BASIC are written
  603.         using IFs and GOTOs.  To help make these more structured, Rascal
  604.         provides a REPEAT block for executing a group of statements over
  605.         and over until a terminating condition is reached.  It looks like
  606.         this:
  607.  
  608.                  REPEAT
  609.  
  610.                  ____
  611.                       statements to keep repeating
  612.                  UNTIL {condition}
  613.  
  614.                  ____
  615.  
  616.         A REPEAT block is used in LC.RAS:
  617.  
  618.                  REPEAT
  619.                       LINE INPUT #1, L$
  620.                       LINE.COUNT = LINE.COUNT+1
  621.                  UNTIL DONE.SW = 1
  622.  
  623.         Remember that REPEAT is like any loop you might make with GOTOs
  624.         in BASIC: you need to change something at some point in the
  625.         statements you're repeating to stop the loop or you'll continue
  626.         forever.
  627.  
  628.             Besides meeting the condition for termination, you can use a
  629.         BREAK statement in the REPEAT block to transfer control
  630.         immediately outside the loop.  To use a BREAK statement, simply
  631.         specify
  632.  
  633.                  BREAK
  634.  
  635.                  ____
  636.  
  637.             Besides REPEAT, Rascal provides a WHILE loop similar to the
  638.         one already in Microsoft BASIC:
  639.  
  640.                  WHILE {condition}
  641.  
  642.                  ____
  643.                       statements to repeat while {condition} is true
  644.                  ENDWHILE
  645.  
  646.                  ____
  647.  
  648.             When using the WHILE block, remember that the {condition} is
  649.         tested before the statements in the body of the loop are ever
  650.         executed, so it's possible to not do them at all.  Also, be sure
  651.         you use ENDWHILE instead of WEND in Rascal, or RASCAL.EXE will
  652.         give you an error message.  When the BASIC program is generated,
  653.         a WHILE block will not have any Microsoft WHILE statements in
  654.         it.  Instead, IFs and GOTOs are used to make the loop, so the
  655.         program can be converted to computers that don't have as advanced
  656.         a version of BASIC.
  657.  
  658.         You can also use BREAK to get out of a WHILE loop.
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.                                                                         Page 10
  667.         111483105
  668.         Rascal Preprocessor User's Manual
  669.  
  670.  
  671.  
  672.         INCLUDE FILES
  673.  
  674.         INCLUDE FILES
  675.  
  676.             A useful technique in programming is designing a program as a
  677.         set of small, independent modules.  This makes programs easier to
  678.         change, since revisions (like a changing the layout of a file)
  679.         only affect a small component (the subroutines that read or write
  680.         the file).  Modular programming is hard to do with BASIC because
  681.         all the pieces of your program must be present in a single file,
  682.         with one set of line numbers.  To help you develop your programs
  683.         as small modules, Rascal has an INCLUDE statement.  Before
  684.         telling you what it does, here's what it looks like:
  685.  
  686.                  INCLUDE {filename.ext}
  687.  
  688.             INCLUDE is used to bring statements into a program from a
  689.         completely separate file during preprocessing, to be part of the
  690.         program when it's translated into BASIC.  The statements in the
  691.         "included" file are also Rascal statements.  They can define and
  692.         reference labels, procedures, and blocks exactly as if they were
  693.         in the original source file.  In fact, the INCLUDEd file can
  694.         itself have INCLUDE statements in it.
  695.  
  696.             INCLUDE is an extremely useful feature of Rascal, because now
  697.         you can write frequently-used pieces of programs, such as input
  698.         routines and screen formatters, once as sets of Rascal procedures
  699.         and just INCLUDE them into each new program that you write.  When
  700.         you edit these new programs you don't have to manually APPEND the
  701.         pieces, since RASCAL.EXE will automatically take care of the line
  702.         numbering for you.  (But not the variables.)
  703.  
  704.  
  705.  
  706.         MULTIPLE STATEMENTS
  707.  
  708.         MULTIPLE STATEMENTS
  709.  
  710.             In BASIC programs, you can write several statements on a
  711.         single line by separating them with the {:} character.  Since
  712.         RASCAL.EXE creates a BASIC program from the statements you give
  713.         it, the {:} character will work just as it does in BASIC, but
  714.         with an important exception: the special Rascal statements
  715.         mentioned here cannot be used in multiple lines.  Instead, they
  716.  
  717.                        ______
  718.         must have their own line whenever you use them.  This restriction
  719.         may change in another version of RASCAL.EXE.
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.                                                                         Page 11
  735.         111483105
  736.         Rascal Preprocessor User's Manual
  737.  
  738.  
  739.  
  740.         ERROR MESSAGES
  741.  
  742.         ERROR MESSAGES
  743.  
  744.             When RASCAL.EXE processes your program, it makes two sweeps
  745.         or "passes" across it.  The first pass checks for errors.  There
  746.         aren't very many that you can make, since most of your program
  747.         will be passed through, untouched except for the addition of line
  748.         numbers, to BASIC.  There are, however, a few ways to produce an
  749.         error message.  The possible messages that you can get are listed
  750.         below, along with an explanation of how to fix the statement that
  751.         caused them.  All of these messages will begin with the name of
  752.         the file being processed (since the error might be in an INCLUDEd
  753.         file) and the offending line number.
  754.  
  755.  
  756.         label {name} defined previously at {file} line {n}
  757.  
  758.             If this error message is displayed it means you have defined
  759.             the label {name} twice (or more...) in your program.  A good
  760.             candidate for the source of this problem is an INCLUDEd file
  761.             with a duplicate of a label you are using in your program.
  762.  
  763.  
  764.         label {name} referenced at {file} line {n} undefined
  765.  
  766.             This error message is saying that you have forgotten to
  767.             define the label {name} in your program.  Possible causes of
  768.             this are forgetting an INCLUDE file (especially likely if you
  769.             see a lot of these messages) or misspelling the label.
  770.  
  771.  
  772.         label {name} type mismatch with {file} line {n}
  773.  
  774.             This error message is displayed when you try to GOTO a
  775.             procedure name or DO a LABEL|.
  776.  
  777.  
  778.         {type} block not active
  779.  
  780.             You used an ENDIF, ENDWHILE, or UNTIL statement in your
  781.             program without first using IF, WHILE, or REPEAT.
  782.  
  783.  
  784.         {type} block already begun at {file} line {n}
  785.  
  786.             You tried to put two ELSE statements in one IF block.  You
  787.             have probably forgotten an IF statement somewhere.
  788.  
  789.  
  790.         procedure {name} already begun at {file} line {n}
  791.  
  792.             You cannot have two procedures started at the same time.  You
  793.             must end the first procedure, {name}, with an ENDPROC
  794.             statement before you can begin your new procedure.
  795.  
  796.  
  797.  
  798.                                                                         Page 12
  799.         111483105
  800.         Rascal Preprocessor User's Manual
  801.  
  802.  
  803.  
  804.         procedure not begun first
  805.  
  806.             This error message means that an ENDPROC statement was found
  807.             in your program when no PROCEDURE statement was active.
  808.  
  809.  
  810.         no WHILE or REPEAT for BREAK
  811.  
  812.             This error message is displayed when you use a BREAK
  813.             statement outside a WHILE or REPEAT blocks.  Remember that a
  814.             BREAK transfers control to the statement immediately after
  815.             the nearest ENDWHILE or UNTIL.
  816.  
  817.  
  818.  
  819.         RASCAL.EXE ABORTS
  820.  
  821.         RASCAL.EXE ABORTS
  822.  
  823.             If you specify a source or object filename that can't be read
  824.         or written to for some reason (such as the name being misspelled,
  825.         the diskette having its write-protect notch covered, etc.) the
  826.         preprocessor program will print the message:
  827.  
  828.                  ABORT- can't open file {filename.ext}
  829.  
  830.         If this happens, you should check to make sure that the source
  831.         file can be read, that any INCLUDEd files it uses can be read,
  832.         and that the object file can be written to.
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                                                                         Page 13
  863.         111483105
  864.         Rascal Preprocessor User's Manual
  865.  
  866.  
  867.  
  868.         PREPROCESSOR SPEED
  869.  
  870.         PREPROCESSOR SPEED
  871.  
  872.             This version of RASCAL.EXE can process your programs at the
  873.         rate of 120-300 lines per minute.  As you can see, this rate is
  874.         highly variable and is based on a number of factors, such as the
  875.         speed of your disk drives, the version of MS DOS you are using,
  876.         even the location of the files on the diskette.  If you have
  877.         frequently-used INCLUDE files you might want to consider putting
  878.         them on a RAM disk if you aren't going to change them often. This
  879.         should improve processing time a lot.
  880.  
  881.  
  882.  
  883.         RASCAL VS. BASIC
  884.  
  885.         RASCAL VS. BASIC
  886.  
  887.             Once you've mastered the Rascal statements, there aren't many
  888.         reasons to continue entering and debugging BASIC programs the old
  889.         way.  You'll probably find that with a little practice Rascal
  890.         programs really are easier to write and maintain.  The only
  891.         reasons to modify the translated BASIC programs directly are:
  892.  
  893.             1.  Quick "patches" or minor changes to the BASIC program
  894.                 when the Rascal source code isn't available or there
  895.                 isn't time to edit it again. (Such as when you're at the
  896.                 customer's office and the payroll program isn't
  897.                 working.)
  898.  
  899.             2.  "Fine tuning" for better performance, to straighten out
  900.                 Rascal's "inside out" IF statements and extra GOTOs in
  901.                 programs where speed and memory size are crucial.
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                                                         Page 14
  929.         111483105
  930.         Rascal Preprocessor User's Manual
  931.  
  932.  
  933.  
  934.         STATEMENT REFERENCE
  935.  
  936.         STATEMENT REFERENCE
  937.  
  938.             Here's a list of all the special statements available to you
  939.         in this version of RASCAL.EXE.  For a complete description of how
  940.         to use them, see the individual sections in this manual.
  941.  
  942.                  BREAK
  943.  
  944.                  DO {procname}
  945.  
  946.                  ELSE
  947.  
  948.                  ENDIF
  949.  
  950.                  ENDPROC
  951.  
  952.                  ENDWHILE
  953.  
  954.                  IF {condition}
  955.  
  956.                  GOSUB {procname}
  957.  
  958.                  GOTO {label}
  959.  
  960.                  INCLUDE {d:filename.ext}
  961.  
  962.                  ON n DO {procname1},{procname2},...
  963.                  ON COM(n) DO {procname}
  964.                  ON KEY(n) DO {procname}
  965.                  ON PEN DO {name}
  966.                  ON PLAY(n) DO {procname}
  967.                  ON STRIG(n) DO {procname}
  968.                  ON TIMER(n) DO {procname}
  969.  
  970.                  ON n GOTO {label1},{label2},...
  971.                  ON ERROR GOTO {label}
  972.  
  973.                  REPEAT
  974.  
  975.                  RESTORE {label}
  976.  
  977.                  RESUME {label}
  978.  
  979.                  RETURN {label}
  980.  
  981.                  UNTIL {condition}
  982.  
  983.                  WHILE {condition}
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.                                                                         Page 15
  993.         111483105
  994.