                           ALL RIGHTS RESERVED.
        
    Note:  Directions  for using this system are included below and in
    the sample Pascal programs of the a:\samples directory.  This is a
    subset of ISO Standard Pascal, with some useful C extensions. Many
    programs in college-level  Pascal textbooks will run on it without
    major change.
        
    A full  ISO standard version of the enclosed Pascal translator and
    p-code interpreter,  together with the complete C source code,  is
    available for $30 from the Austin Code Works  (whose address is at
    the end of this file).

    A companion  ISO standard  Pascal to C translator system, together
    with C source code, is also available from Austin Code Works.  The
    Pascal to C translator is based on the p-code interpreter,  and it
    generates optimizable C code that runs  almost as fast as programs
    compiled directly from C code. Advanced versions of these systems,
    extended  or  custom-tailored  for efficient operation on your own
    system, can be  commissioned  from the author at the address given
    at the end of this file.
        
    As  a  demonstration  of  this,  the  "primes.exe"  program in the
    \samples  directory  of  this  diskette  was  compiled  from   the
    "\samples\primes.pas" program after a Pascal to C translation. 
        

    ==================================================================

    DISCLAIMER:
        
         These programs are provided to the public domain as a service
    to programmers. They may be copied freely and distributed for edu-
    cational purposes with the following restrictions: 
        
         1. Persons  or organizations wishing to use these programs for
    commercial resale,  or to incorporate these programs into their own
    systems for commercial resale,  whether in whole or in part,   must
    first obtain written permission from the author.
        
         2. Charges for reproduced copies  must  be  limited  to  cost
    (disks, postage and handling). 
        
         3. Any modifications to the programs from the originally dis-
    tributed  version  must  be  clearly indicated. Such modifications
    should retain the genealogy of the program.
        
         4. All documentation and notices supplied with these programs
    must be included in any reproduced versions.
        
         5. All warranties connected  with  these  programs  are  dis-
    claimed.  In particular, the author assumes no responsibility that
    the programs will operate as documented, nor is the author respon-
    sible for direct, indirect, or consequential damages. Any and  all
    risk associated with using these programs, in whole or in part, is
    the user's. 

    ==================================================================
        
    NOTES ON USING THE TRANSLATOR:
        
    The  "A:\P_PASCAL\DO.BAT"  file gives a  simple description of the
    calling  sequences for translating and executing a Pascal program.
    A more elaborate explanation of the command line calling sequences
    and special  features of the translator  and  interpreter is given
    below.

        
    FEATURES AND RESTRICTIONS
        
    This is a "Portable Pascal" system, with some C extensions. Modern
    college-level standard Pascal programming textbooks,  such as "Oh!
    Pascal",  by Cooper and Clancy,   give examples  of Pascal  source
    programs that will run on this system.  The C extensions,  such as
    C-style file inclusion during translation, the "system" call,  and
    masking and shifting operations,  appear as examples in the demon-
    stration programs of the a:\samples directory on this diskette.

    This Pascal in C implementation limits sets to 64 members and str-
    ing constants to no more than 80 characters apiece. Any mix of up-
    per and lower case identifiers and reserved words can be used, but
    identifiers  are  stored  internally  in  an  eight-letter format.
    European ascii alphabet letters may be  used  in  identifiers.  At
    present,  the  predeclared constant "maxint" has a value of 32767,
    which means that any long arithmetic must be done using REAL  num-
    bers.  Standard Pascal functions "RESET" and "REWRITE" are not im-
    plemented in Portable Pascal, and there in this public-domain ver-
    sion of the system of two external textfiles that, when used, must
    be listed  as parameters  in  the program header and should not be
    declared within the program. The system available from Austin Code
    Works is a standard Pascal with full Pascal data and text files.

    Additional minor restrictions: procedures may not be passed as pa-
    rameters.    The "packed" and "unpacked" keywords may be used, but
    they have no effect at present; instead, all character and boolean
    arrays are automatically stored as packed character arrays.   Pack
    and unpack are not implemented, but an example of "do it yourself"
    packing and unpacking using  the shifting and masking operators is
    included in the "a:\samples" directory ("truefalse.pas").

    See the yesno.pas program in the a:\samples directory for examples
    of string assignment and comparison (full standard Pascal version).

    A  "SYSTEM(packed_char_array)"  function  identical in behavior to
    the C version of "system(char *)" is implemented.     If you use a
    Pascal packed char array instead of a string constant  as argument
    to the "system" function, be sure to intialize your array properly
    with a blank string constant of the correct size.

    The  external  Pascal file  names  are limited  to  eight  letters
    and  must  appear  in  the first line  "program xxxxx(a, b, ...);"
    statement. (The  file  name  may  also apear in the  command  line
    with a Unix or Dos path prefix.) The standard P-Pascal prr and prd
    files are no longer  predeclared  as external  textfiles.  Prr and
    prd can be listed as program parameters or other names can be used
    instesad.    "Text" and "File" can not be used in variable or type
    declarations in Portable Pascal.  External files are automatically
    declared as text files by the system.     A version of this system
    removing  many of these  restrictions is available from the Austin
    Code Works,  along with the complete C source code,  for a nominal
    fee. (See the address at end of this file.)

    The  standard  Pascal "NEW" and "DISPOSE" procedures are available
    for acquiring individual data nodes and returning them to the Pas-
    cal heap. In addition, "MARK" and "RELEASE" are available for  use
    in  returning  entire  blocks of data to the heap, rather than in-
    dividual nodes. Programs can  be  written  using  only  "NEW"  and
    "DISPOSE", without mention of "MARK" and "RELEASE". Or, "NEW" (and
    optionally,  "DISPOSE") can be used in combination with "MARK" and
    "RELEASE". However,  while  "NEW"  and  "DISPOSE"  are  relatively
    well-behaved  operations,  "MARK"  and  "RELEASE"  have to be used
    carefully  as  paired  operations that have side-effects.   One of
    these side effects is that all data nodes acquired by "NEW"  after
    a  "MARK"  operation are automatically disposed  of by the call on
    "RELEASE".  Furthermore, calls on "MARK" and  "RELEASE"  are  only
    defined if they are paired so each call on "MARK" is balanced by a
    corresponding call on "RELEASE".  (The a:\samples listtest.pas and
    newtest.pas programs are examples of their use.)  The PC-SIG "Near
    arrays" version of the Pascal p-code interpreter has approximately
    1900 words of Pascal heap data available for "NEW" and "DISPOSE".

    Some  small  source program examples are included in the "samples"
    directory on this diskette. They illustrate the  general  form  of
    programs  accepted  by  the translator and the required translator
    options directives to precede programs.
        
    TRANSLATOR OPTIONS:
        
    The Pascal program examples in the a:\samples file illustrate the
    use of translator options.   In particular, "pi.pas" shows how to
    turn the translator listing on and off during translation of that
    program. All programs contain one or more lists of translator op-
    tions of the form: 
        
      (*$ ... *)
        
    where  the " ... " in the middle is some sequence of the following
    options separated by commas: 
        
         c+  causes p-code to be written to the ".pcd" file.   If c+
             does not appear,  or if c- or c is written,  the source
             program will be checked for correctness, but not trans-
	     lated.

         d+  causes  the translator  to  put range checks into the p-
             code translation of the program.   These checks are use-
             ful for debugging  programs,  but also cause programs to
             run slowly. They are partly responsible for Pascal's re-
             putation as a slow programming language. The default op-
             tion is d-, for omitting these checks to improve program
             speed and to  pass  "flexible dimension"  arrays to sub-
             programs.  The d+ option can  be turned off  within your
             program by following it with a  d- option at the desired
             point in the program.

         i+  causes the file whose quoted name follows to be read by
	     the translator:  i. e.,
		{$i+'a:\samples\vpack.p'}
	     includes the  vpack.p file at that point in the program.
	     The file source code has to be  to be correct  for  that
	     point in the program where its insertion occurs.   Up to
	     seven  levels of file inclusion from any source file are
	     allowed by the system. (For an example of how to use the
	     i+ option, see the 'a:\samples\factorial.pas' file.)

         l+  causes the program to  be  listed  to the  "stdout" file
             (the  monitor  screen).   The listing can be re-directed
             from the  screen to the line printer using the ">" redi-
             rection operator on the command line.  l+ is the default
             option (the  listing will  appear if l+ is omitted).  To
             turn off the listing,  use l-.   Programs will translate
             several times faster with the screen listing disabled.

	 o+  causes  the  translator  to route its translation of the
	     source program to the stdout file,  causing each execut-
	     able source statement to  be followed by the p-code that
	     it generates (the ".pcd" file will be empty as a result,
	     but must still  be mentioned on the translator's command
	     line). Default option is o-.
        
         t+  causes the translator  to  write out its internal tables
             listing declared constants, procedures, and functions at
             the end of the translation pass.  Its use is to discover
             what the translator  believes  the program variables and
             procedures to be.  Default option is t-.

    =================================================================

    CALLING THE TRANSLATOR AND INTERPRETER UNDER DOS:
        
    For the translator:
    ==================================================================
        
        translator  your_source_code.pas  p_code_output.pcd
        
        or
        
        translator con  p_code_output.pcd
        
    ==================================================================
        
    Note  that  the  .pcd file extension for the output p-code file in
    the example is necessary to interface properly with both  the  in-
    terpreter and the C code generator programs. 
        
    The  command  lines  above  illustrate  how source programs can be
    typed in from the keyboard if "con" is used as an argument on  the
    translator  command  line;  but  editing is limited to the current
    line only. Refer to the DOS manual description of  the  "copy  con
    output_file"  command for information about how to use the console
    keyboard for program  input  to  the  translator.  In  particular,
    "control-Z"  or  ^Z  is  used as the end of file mark to terminate
    source programs. 
        
    Files external to the program are named in standard  Pascal  style
    on the  "Program xxxxx(Input, Output, File1, File2);" line of your
    Pascal program.      These external files are names of up to eight
    letters each (the same as Pascal identifiers), and they match file
    names  (preceded  by optional operating system pathnames) that ap-
    pear on the command line of your program. Thus, for example, 
        
             Program Fileptrs(Input, Output, Prr);
             ....
             ....
             END.
        
    can be called by a command line sequence of the form: 
        
             interpreter fileptrs.pcd c:\xxx\prr
        
    or
        
             interpreter fileptrs.pcd a:\yyy\zzzz.prr
        
    or even
        
             interpreter fileptrs.pcd prr
        
    depending on the file path designation that you,  the  user,  find
    convenient to use. 
    
    Translator  listings  are  sent  to  the  screen,  unless  DOS I/O
    redirection is used: 
        
    ==================================================================
        
      translator source.pas  object.pcd  >  lpt1 (* parallel printer *)
        
    or
        
      translator source.pas  object.pcd  >  com1 (* serial printer *)
        
    or
        
      translator source.pas  object.pcd  >  a:listing.asc
        
    ==================================================================
    
    
        
    NOTES ON USING THE INTERPRETER:
        
    Interpreter command line with optional files in brackets:
        
    ==================================================================
        
       interpreter  p_code_input.pcd [path1][file1] [path2][file2]
        
    ==================================================================
        
    The interpreter also has available the standard Pascal  Input  and
    Output  files,  known  in  the  C language as stdin and stdout. So
    programs translated for the interpreter can access Input  (stdin),
    Output (stdout) and up to two external Portable Pascal text files.
    See the a:\samples directory for examples of how to use files.
        
    Note that the interpreter has some limitations, most important  of
    which is that sets can have up to 64 members.  This is a relative-
    ly complete Pascal otherwise. It is intended as a teaching system,
    with the p-code interpreter to be used  by  students  in  compiler
    courses.  Thus,  the p-code output from the translator is in ascii
    format, so that it can be inspected and compared with  the  source
    code  and  used  in  conjunction  with  the  source code to p-code
    cross-reference generated in the translator listings.
        
    Translator error messages use the error number format that appears
    in the Pascal User Manual listed below and in some C compilers  as
    well: 

         Jensen, K. and Wirth,  N.  Pascal  User  Manual  and  Report.
                 Springer Publishing Co., 1974. 
        

    The full listings and executable files for the expanded version of
    this system or for the  Pascal to C translator are  available at a
    nominal price (presently $30) from:

    Austin Code Works
    11100 Leafwood Lane
    Austin, Texas 78750-3409
    USA

        
    Author's address for correspondence:
    
        Victor Schneider
        291 Summit Avenue
        Brighton, MA 02146
        USA

