home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3123 < prev    next >
Encoding:
Internet Message Format  |  1991-03-24  |  1.5 KB

  1. From: markh@csd4.csd.uwm.edu (Mark William Hopkins)
  2. Newsgroups: alt.sources
  3. Subject: Non-trivial self-reproducing programs
  4. Message-ID: <10458@uwm.edu>
  5. Date: 23 Mar 91 06:39:58 GMT
  6.  
  7. In article <1991Mar19.165839.15308@isc.rit.edu> rxg3321@isc.rit.edu (R.X. Getter ) writes:
  8. >hi,
  9. >    I am looking for a c program which outputs itself. Has anyone
  10. >seen one or heard of one? (No, it cannot read its own source code.)
  11.                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  12. But can it decompile its own object code?
  13.  
  14. Generally the challenge is to take any non-trivial C program generator (meaning
  15. a decompiler) and make it self-reproducing.
  16.  
  17. Of course, since this (otherwise) general-purpose program will be formatting
  18. its generated source code in a fixed way and naming its variables in a fixed
  19. way, it should be written conforming to those restrictions if it is going to
  20. ever be able to reproduce a copy of itself from its own object code.
  21.  
  22. Equally obvious is that you can write it any way you want (and in any
  23. language), compile it into object code and then run the object code on itself.
  24. The generated source code should then be syntatically self-reproducing
  25. (assuming the original was semantically self-reproducing) when re-compiled and
  26. run on its own object code.  If not, you can repeat the process until it
  27. converges to a fixed point...
  28.  
  29. And most obvious of all is that you can start with ANY decompiler and do this
  30. provided you can compile the decompiler, so it can decompile its object code...
  31.