C not LALR(1) & compiler bugs

Mike Farren farren at well.UUCP
Mon Jan 27 20:15:00 AEST 1986


In article <10200035 at ada-uts.UUCP>, richw at ada-uts.UUCP writes:
With a little creative deletion: 
> C's grammar is CONTEXT SENSITIVE !?    Can it be ?!
>       To see this, consider this program line
> 
>                        A ( *B );
> 
>     If A has been defined as a typedef name, then the line is a
>     declaration of a variable B to be of type "pointer to A."
>     (The parentheses surrounding "*B" are ignored.)  If A is not
>     a type name, then this line is a call of the function A with
>     the single parameter *B.  This ambiguity cannot be resolved
>     grammatically.
> Doesn't that make you wonder if something is SERIOUSLY wrong with C?
   
      No, it supports my long-held theory that even Kernighan and Ritchie
are only human.  Oops, perhaps, but hardly a fatal flaw.

> Personally, I think that the real fault for my "buggy" compiler
> lies not with the compiler writer, but in the shoddy language design
> that haunts the deep-dark corners of C.  I mean, is there any excuse
> for the grammar being context sensitive?  Or, for that matter, for
> identifiers having only 8 significant characters?
> 
> -- Rich  "Picky-Picky-Picky"  Wagner

	Well, I think you've lived up to your nickname.  One example of
context sensitivity, especially in an area which is designed solely to
make things a little easier on us poor programmers, hardly makes for 
"shoddy language design".  There's probably no excuse, but then, I don't
think that one is needed - too many good programs have been written for
two many years using C for me to think it shoddy.  As to the 8 significant
characters, that's a problem for the compiler designer, not a built-in
limitation, and undoubtedly stems from associated assembler and linker
limitations, not C's own.

-- 
           Mike Farren
           uucp: {your favorite backbone site}!hplabs!well!farren
           Fido: Sci-Fido, Fidonode 125/84, (415)655-0667



More information about the Comp.lang.c mailing list