home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 109.lha / PD_C / PDC.ReadME < prev    next >
Text File  |  1986-11-20  |  7KB  |  196 lines

  1. PDC: A public Domain Optimizing C Compiler.
  2.      01 October 1987.
  3.  
  4.      Original by Matthew Brandt.
  5.      Ported to the Amiga by Jeff Lydiatt.  You can reach me at:
  6.  
  7.      USENET:  jlydiatt@jlami.vnet.van-bc.UUCP
  8.     or :  {ihnp4!alberta!ubc-vision,uunet}!van-bc!jlami!jlydiatt
  9.  
  10.  
  11.      POSTAL:
  12.           Jeff Lydiatt
  13.           #46-11291-7th Avenue.
  14.           Richmond, B.C.
  15.           Canada.
  16.           V7E4J3.
  17.  
  18. SYNOPSIS
  19.  
  20.  
  21.    A  freely  distributable  (for  non-commercial  purposes) optimizing C
  22. compiler that generates metacomco-compatible assembler source code.  This
  23. is  an  instructional  only version, but with a bit of work could be made
  24. into  a  public domain working compiler for the Amiga.  Please don't call
  25. me  and  tell me it doesn't work.  I know!  I am releasing it in the hope
  26. that  someone  else has the time to devote to it.  If you do come up with
  27. some improvements, I would like to get the source from you though.
  28.  
  29.  
  30.  
  31. INTRODUCTION
  32.  
  33.   Here  is  a  Public Domain optimizing C compiler that I downloaded from
  34. the  IBM  sig  on  "The  Source"  last fall and have fixed up to generate
  35. metacomco-compatible  assember  source  code  that  can  be run through a
  36. public  domain  assembler  (also  supplied) and The Software Distilleries
  37. Blink to produce an executable program.  The source is obviously the same
  38. as  the  one  on  Fish Disk #53, although there may have been a few minor
  39. differences.
  40.  
  41.   The  compiler  originally  generated  what  I  assume  to be Unix-style
  42. MC68000   assembler  source  code.   I  spend  many  evenings  last  fall
  43. converting  it  to  the default 16 bit integer Manx Aztec C, fixing a few
  44. bugs  and  omissions,  and  getting  it  to  assemble under the Metacomco
  45. assembler.   Then  Charlie  Gibbs  came out with his PD assembler, and we
  46. were  both  hoping  that  we  would  be  able to have a compiler we could
  47. release  as  for  general  distribution.   Unfortunately,  that  was last
  48. spring!   We both seem to be busy on other projects, and the compiler has
  49. not seen any progress since February.
  50.  
  51.   I  have  therefore  decided  to release the code as is in the hope that
  52. someone  else  will  get  enthused, as I did, and will put some more work
  53. into  it.   I have gathered together the source, some test examples, a PD
  54. make  program and some source code for a C library.  Please note that the
  55. original  source  is  copyrighted  by  Matthew  Brandt  but may be freely
  56. distributed for non-commercial use.
  57.  
  58.  
  59. COMPILER USEAGE
  60.  
  61.  
  62.    The syntax for invoking the compiler is
  63.  
  64.     PDC [-n] [-l] SourceFileName
  65.  
  66.    where
  67.     -n    will bypass the optimization phase.
  68.  
  69.     -l    will give a listing of the source code in the
  70.         file named SourceFileName.lis.
  71.         By default, no listing is produced.
  72.  
  73.     SourceFileName is the name of the source.
  74.  
  75.     The compiler will output the generated assembler source
  76.     code in a file called SourceFileName.s.
  77.     
  78.  
  79.  
  80. COMPILER SPECIFICATIONS
  81.  
  82.   This  is  a  top down recursive descent compiler with a post-processing
  83. peephole  optimizer.   PDC  reads in C source code and outputs metacomco-
  84. compatible  assembler  source  code.  PDC supports most of the standard C
  85. statements including enum, but is deceidly limited in breadth of variable
  86. types.  Some of the limitations are:
  87.  
  88.     o The compiler does not support floating point, although you may
  89.       declare them, but the code generator does not support them..   
  90.  
  91.     o The compiler has a very primitive preprocessor.  There is a
  92.       very good one on Fish disk 28 that I hoped to interface as
  93.       a prior stage but didn't have time.  What's C without a good
  94.       preprocessor?
  95.  
  96.     o PDC treats all constants as 4 byte integers.  This will cause
  97.       problems if you call a ROM routine such as printf with the
  98.       following: 
  99.  
  100.         printf( "Here is the character %c\n", 'x' );
  101.  
  102.       The code fragment:
  103.  
  104.         char x;
  105.         x = 'x';
  106.         printf( "Here is the character %c\n", x );
  107.  
  108.       will work ok though.  The lesson to be learned if you plan to
  109.       use PDC is to pass variables rather than constants for all
  110.       non-long integers.
  111.  
  112.  
  113.     o PDC also needs a library of all the standard library functions,
  114.       especially the I/O functions printf, getchar, putchar, gets, puts
  115.       etc.
  116.  
  117.     o PDC does not support several C constructs.  Multiple initializations
  118.       like "x=y=0;" are not supported.
  119.  
  120.  
  121. KNOWN BUGS
  122.  
  123.    PDC has a number of bugs that I am aware of.   There are undoubtedly
  124. a large number I haven't come across yet.
  125.  
  126.     o  Why is 
  127.         char **argv;
  128.        handled ok for example, but
  129.             char *argv[];
  130.        is not?
  131.  
  132.     o The optimizer isn't perfect.  Have a look at the code generated
  133.       for the "default" statement in the example, "logic.c".
  134.  
  135.     o Short and character constants are not handled properly.
  136.  
  137.  
  138.  
  139. The original read me file posted on the follows:
  140.  
  141. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  142.  
  143. NOTICE:
  144.  
  145. 68000 C compiler
  146.  
  147. Copyright 1984, 1985, 1986 Matthew Brandt.
  148. all commercial rights reserved.
  149.  
  150. This compiler is intended as an instructive tool for personal use. Any
  151. use for profit without the written consent of the author is prohibited.
  152.  
  153. This compiler may be distributed freely for non-commercial use as long
  154. as this notice stays intact. Please forward any enhancements or questions
  155. to:
  156.  
  157. Matthew Brandt
  158. Box 920337
  159. Norcross, Ga 30092
  160.  
  161. This compiler is an optimizing C compiler for the Motorola 68000 processor.
  162. It has successfully compiled itself on UNIX system V running on a Motorola
  163. VME-10. Since this code was written for a machine with long integers it may
  164. exhibit some irregularity when dealing with long integers on the IBM-PC.
  165. The author makes no guarantees. This is not meant as a serious developement
  166. tool although it could, with little work, be made into one. The bugs and
  167. limitations of this compiler are listed below:
  168.  
  169. -Although you may declare floating point types the code generator does
  170. not know how to deal with them. They should therefore be avoided.
  171. -The preprocessor does not support arguments to #define'd macros or
  172. any of #line #ifdef... etc. Only #include and #define are supported.
  173. -Function arguments declared as char may not work properly. Declare
  174. them as int.
  175. -The size of functions is slightly limited due to the fact that the
  176. entire function is parsed before any code is generated.
  177. -The output of the compiler is in the UNIX 68000 assembler format.
  178.  
  179. To run the compiler type "cc68 sieve.c". This will compile the program sieve
  180. and produce two files; sieve.lis is a source listing with a symbol type
  181. reference; sieve.s is the 68000 assembly language produced.
  182.  
  183. The file lib.s is the assembly source for some runtime support routines
  184. which must be loaded with the final code. The is no standard runtime library
  185. support.
  186.  
  187. The compiler can be compiled by microsoft C version 3.0 or higher. MSC will
  188. issue lots of warnings but they can be ignored. The file make.bat will
  189. rebuild the compiler if MSC is available.
  190.  
  191. If you wish to make commercial use of all or part of this package please
  192. contact me at the above address or (404)662-0366. Any voluntary contribution
  193. from non-commercial users will be greatly appreciated but is by no means
  194. necessary. enjoy...
  195. Matt Brandt
  196.