Non-trivial self-reproducing programs

Mark William Hopkins markh at csd4.csd.uwm.edu
Sat Mar 23 16:39:58 AEST 1991


In article <1991Mar19.165839.15308 at isc.rit.edu> rxg3321 at isc.rit.edu (R.X. Getter ) writes:
>hi,
>	I am looking for a c program which outputs itself. Has anyone
>seen one or heard of one? (No, it cannot read its own source code.)
			    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
But can it decompile its own object code?

Generally the challenge is to take any non-trivial C program generator (meaning
a decompiler) and make it self-reproducing.

Of course, since this (otherwise) general-purpose program will be formatting
its generated source code in a fixed way and naming its variables in a fixed
way, it should be written conforming to those restrictions if it is going to
ever be able to reproduce a copy of itself from its own object code.

Equally obvious is that you can write it any way you want (and in any
language), compile it into object code and then run the object code on itself.
The generated source code should then be syntatically self-reproducing
(assuming the original was semantically self-reproducing) when re-compiled and
run on its own object code.  If not, you can repeat the process until it
converges to a fixed point...

And most obvious of all is that you can start with ANY decompiler and do this
provided you can compile the decompiler, so it can decompile its object code...



More information about the Alt.sources mailing list