[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | Languages |
Notice: | Speaking In Tongues |
Moderator: | TLE::TOKLAS::FELDMAN |
|
Created: | Sat Jan 25 1986 |
Last Modified: | Wed May 21 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 394 |
Total number of notes: | 2683 |
43.0. "Ambiguous langauge example :-)" by REX::MINOW () Mon Nov 05 1984 10:55
In case you are still wondering which language to choose for your
projects, perhaps the following could help. (From USENET)
> From: [email protected] (Sjoerd Mullender)
> Newsgroups: net.lang.c
> Subject: Is it C or is it Pascal?
> Message-ID: <[email protected]>
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
T.R | Title | User | Personal Name | Date | Lines |
---|
43.1 | | ADVAX::A_VESPER | | Tue Nov 06 1984 08:46 | 8 |
| SIMULA-67 on DECsystem 10's & 20's allowed for one file to
contain both the SIMULA header and the MACRO-10
implementation of a routine. The SIMULA header was used to
create the attribute file, so that the compiler could make
sure the routine was called correctly by other (seperately
compiled) SIMULA code.
Andy V
|