Small introspective program
    Doug Gwyn 
    gwyn at smoke.brl.mil
       
    Sun Mar 17 08:40:50 AEST 1991
    
    
  
In article <1991Mar16.163213.9794 at bingvaxu.cc.binghamton.edu> kym at bingvaxu.cc.binghamton.edu (R. Kym Horsell) writes:
>The following is a (probabalistic) example. It relies on fixpoint
>theory to guarantee finding the appropriate parameters (in fact the
>search for any self-replicating automaton can use this theory) and 
>terminates in several iterations.
I think it was Ken Thompson who tried the experiment of taking the
diagnostic output from a UNIX C compiler and feeding it back to
another invokation of the compiler as source code:
	echo foo bar > X	# initial invalid "program"
	while	:
	do	cp X x.c
		cc x.c > X 2>&1 || :
		if cmp -s X x.c
		then	cat X
			exit
		fi
	done
    
    
More information about the Comp.lang.c
mailing list