Anybody have any experience with (Vax) Tartan C compiler?

Richard Draves draves at harvard.ARPA
Fri Dec 7 14:19:50 AEST 1984


> Just for general information, the Tartan Labs people have a book out
> (C: A Reference Manual by Samuel Harbison and Guy Steele) that goes
> fairly in depth about the implementation details of implementing a C
> compiler. It also has a true LALR(1) grammar in appendix C for C.

I haven't looked at their grammar, but I doubt if what I would call
a true LR(k) grammar for C is possible.  The problem is typedefs.
The expression "(a) * b" may be either a cast or a multiplication,
depending on whether "a" is a variable or a typedef.  Parsing this
requires a symbol table lookup.  The grammars I have seen all have
their lexxer make this check, contingent on a flag that is set by
the parser.  This is because declarations like "int a" in a function,
after "a" has been typedef'ed, are legal, so sometimes "a" must be
recognized as a vanilla identifier, and sometimes as a type.

Rich



More information about the Comp.lang.c mailing list