PASCAL like C with no sweat

krishna at cg-d.UUCP krishna at cg-d.UUCP
Sat Feb 14 04:14:56 AEST 1987


I am new to this newsgroup and am not sure if there has been an exchange
of information on mapping PASCAL to C and vice versa. I migrated to
C from PASCAL, and to help the transition, I developed these macros. But
I have continued to use them because they have made my *C* programs
eminently more readable. Making the transition back from hard core C
may be difficult, but for those of ye who are new to C this may help...

/* Cut here -------------------------- ereh tuC */

#define begin {
#define end }
#define true 1
#define false 0
#define TRUE true
#define FALSE false

/* Control Structures */

#define If if(
#define Then )
#define Else else
#define While while(
#define Do )
#define For for(

/* Misc Stuff */

#define boolean char
#define and &&
#define or ||
#define not !
#define record {

/* Cut here ------------------------- ereh tuC */

/* Sample uses ... */

While true Do ...
For i=0; i < Junk; i++ Do
If (x < 10) and not found
Then begin
	fdgkgj;
	sdfkslf;
     end
Else dkfhgkjfdhg;

See .. No extraneous '(' and ')'. Makes the code look really clean.
------
In real life: B. C. Krishna @ Compugraphic Corp. MA.
UUCP	    : ...decvax!cg-d!krishna



More information about the Comp.lang.c mailing list