Language: Modula-2 Author: Gregory S. Vigneault (telic@netcom.ca) Note: Whitespace might be screwed up...should fix itself after one iteration MODULE Quine; (* Modula-2 *) (* Gregory S. Vigneault, http://www.netcom.ca/~telic *) FROM InOut IMPORT Write, WriteLn, WriteString; VAR k :CARDINAL; PROCEDURE q (s :ARRAY OF CHAR); BEGIN CASE k OF 0..15, 52, 53 : WriteString(s); WriteLn; | 18..35 : WriteString('q('); Write(42C); WriteString(s); Write(42C); WriteString(');'); WriteLn; ELSE ; (*ignore*) END; INC(k); END q; BEGIN (*Quine*) k := 0; REPEAT q("MODULE Quine; (* Modula-2 *)"); q("(* Gregory S. Vigneault, http://www.netcom.ca/~telic *)"); q("FROM InOut IMPORT Write, WriteLn, WriteString;"); q("VAR k :CARDINAL;"); q("PROCEDURE q (s :ARRAY OF CHAR);"); q(" BEGIN"); q(" CASE k OF"); q(" 0..15, 52, 53 : WriteString(s); WriteLn;"); q(" | 18..35 : WriteString('q('); Write(42C);"); q(" WriteString(s); Write(42C); WriteString(');'); WriteLn;"); q(" ELSE ; (*ignore*)"); q(" END;"); q(" INC(k);"); q(" END q;"); q("BEGIN (*Quine*)"); q("k := 0; REPEAT"); q("UNTIL k > 53;"); q("END Quine."); UNTIL k > 53; END Quine. Regards, Greg Vigneault http://www.netcom.ca/~telic 1998.Dec.25, Toronto, Canada.