'C', is it's grammar context sensitive ?

Christopher R Volpe volpe at underdog.crd.ge.com
Fri Aug 24 09:40:11 AEST 1990


A couple of points:

Of course it's context sensitive. It's also context free. The set of
context sensitive grammars is a proper superset of the set of
context free grammars. I assume what you wanted to know is whether 
it is context sensitive but NOT context free.

The answer to this is NO. The grammar is indeed ambiguous, but it is
certainly context free, because all the productions have only one
non-terminal on the Left Hand Side. Whether or not a grammar is
context free depends only on the structure of the productions. 

To disambiguate the grammar, typedef_name must be a token returned
by the lexical analyzer. Naturally, this means that the lexical
analyzer, when it sees what looks like an identifier, has to check with
the symbol table to see if it has already been declared as a typedef name
in order to determine what token to return to the parser.


==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.lang.c mailing list