C not LALR(1)

Jack Jansen jack at boring.uucp
Sun Jan 26 05:20:14 AEST 1986


This 'not LALR' business isn't that interesting, since the
C syntax has a few ambiguities. How about this one:

foo(a,b) int a,b; {
    int *p;

    p = &b;
    a = a/*p;
    return(a);
}

Simple, eh? Just returns a/b in a difficult way.
But, did you notice that the routine isn't finished yet?
END OF COMMENT */+1;
    return(a);
}
So, now it is.

Anyway, all C compilers I've ever tested this on will see the
first /* as comment-open (probably somewhere far in the beginning,
in the lexical analyzer or thereabouts), but still, it's not
really what you'ld like to have in a language.....
-- 
	Jack Jansen, jack at mcvax.UUCP
	The shell is my oyster.



More information about the Comp.lang.c mailing list