[net.lang.c] Is it C or is it Pascal?

sjoerd@tjalk.UUCP (Sjoerd Mullender) (10/31/84)

What do you C hackers think of this beauty?

(* main())()
{
	/* Is it Pascal? Or is it C? Or is it something else? *)
	program main(output);
	begin
		writeln('Hello World')
	end.
	{ Are you sure? Lint is... */
	printf("Hello World\n");
	return (int ( * )()) 0;
}

--
		Sjoerd Mullender &
		Robbert van Renesse
		Vrije Universiteit
		Amsterdam, The Netherlands

		{sjoerd,cogito}@vu44.UUCP
		...!{decvax|philabs|seismo}!mcvax!vu44!{sjoerd,cogito}

davis@hplabs.UUCP (Jim Davis) (11/03/84)

>	From: sjoerd@tjalk.UUCP (Sjoerd Mullender)
>	Newsgroups: net.lang.c
>	Subject: Is it C or is it Pascal?
>	Message-ID: <375@tjalk.UUCP>

    While we are on the subject of Ambigous programs
I might add that a humorous (Paul Gootherts & I thought)
article entitled "Common Programming Language Ambiguity"
was published in SIGPLAN February 1981 (?) by
James W Davis, and Paul D Gootherts.

    It is easy to show that -- given either a Pascal
compiler that ignores material after end., or a C or
Pascal compiler that ignores unterminated comments --
any collection consisting of a FORTRAN program, a Pascal
Program, and a C program can be combined into one source
file that will compile correctly in each language.
The programs must satisfy some restrictions (e.g. no
pascal or C identifiers >75 chars in length,
no strings containing another language's close comment
symbol, the rest left to the interested reader).

Below I enclose Sjoerd Mullender & Robbert van Renesse's
program made 4 lingual in the style of the article in SIGPLAN.
Note: the first two lines are not in error, they are indented
to column 73.

									(* main(
									))(){/*
C       Note that we are now in comment mode in Pascal, C, and FORTRAN
C	If we wish, we may insert any FORTRAN here ( e.g.
	DO 10 I=1,0
	    WRITE(6,6)
6	FORMAT (42HTHIS WAS COMPILED BY A FORTRAN 66 COMPILER    )
	STOP
10	CONTINUE
	WRITE(6,7)
7	FORMAT (42HTHIS WAS COMPILED BY A FORTRAN 77 COMPILER    )
	STOP
	END
C *)	(* Note that we may place Pascal source here *)
C *)	program main(output);						 (*
C *)	begin								 (*
C *)	writeln('A Pascal compiler compiled me')			 (*
C *)	end.								 (*
C */	/* Note that we may place C source here */			 /*
C */	printf("A C compiler compiled me\n");				 /*
C */	return (int ( * )()) 0;						 /*
C */	}


-- 
					 Jim Davis (James W Davis)
				{any_of_the_biggies} !hplabs!davis
					  davis%hp-labs@csnet-relay
------------------------------------------------------------------