C preprocessing

Jens Tingleff jensting at skinfaxe.diku.dk
Tue Sep 25 05:25:58 AEST 1990


rob at raksha.eng.ohio-state.edu (Rob Carriere) writes:

>In article <223 at srchtec.UUCP> johnb at srchtec.UUCP (John T. Baldwin) writes:
>>#1  Why does the program have to be processed as a one-dimensional string
>>    of tokens?
>>
>>It doesn't.
>>
>>At least, programs in general do not have to be processed this
>>way.  Your C programs are, because the language has been defined that way.
>>The reason why language designers like to do this is because it makes it
>>easier to write the compiler (i.e. the lexer and parser are easier).

And, way out of copmp.lang.c, OCCAM. The english language designed 
specifically for parallel processing has indention as a block delimiter.
E.g. (the SEQ means SEQuence)

      SEQ
	SEQ			-- Some operations in sequence
  	  i := 7
etc etc
	  do.some.thing.or.other(arg.1, arg.2)
	PAR			-- Two operations in parallel
	  do.one.thing()
	  do.another()

etc. (the dot `.' is a legal part of a name, weird hu ?)

The only thing that makes this bearable, is the idea of folding text
editors. In a folding text editor, a group of lines can be made to appear
as one line (usually a descriptive caption), so the above becomes

     SEQ
	SEQ
          ... Some operations in parallel
	PAR
	  ... Two oparetions in parallel

This makes the thing readable (slightly..).

>There is at least one other reason.  Many people (especially those who have
>been exposed to FORTRAN) consider formatted languages to be A Bad Thing.  The
>reason being that my idea of legible formatting need not coincide with the
>language designer's. 

Amen to that. In OCCAM for instance you can't use one of my favourite 
constructions (but then again, why would you if you weren't me ;^)

	IF .. THEN  init_statements;
	  real_work_statements;
	END;

in Modula-2 where I don't need the BEGIN from pascal.. .

Back to you C sufferings ;^)

	Jens
Jens Tingleff MSc EE, Institute of Computer Science, Copenhagen University
Snail mail: DIKU Universitetsparken 1, DK2100 KBH O
"It never runs around here; it just comes crashing down"
	apologies to  Dire Straits 



More information about the Comp.lang.c mailing list