$ in identifiers -- poll
Oliver Boliver Butt
85488116 at sdcc3.UUCP
Thu Dec 13 00:35:49 AEST 1984
> For what it's worth, the current ANSI C draft (12 Nov 1984) says that
> dollar signs aren't in C's vocabulary at all (except for the usual
> exemption for comments and strings), but adds the following in the
> "Common extensions" discussion in appendix E:
>
> E.4.4.1 Specialized identifiers
>
> Characters other than the underscore _, letters, and digits, that
> are not defined in the required source character set (such as the
> dollar sign $) may appear in an identifier.
*
Yacc uses $$ and $n to allow for manipulations on its parsing stack. In this
case, $$ & $n are used as pseudo identifiers for the stack in the C code actions
which get executed when a rule gets reduced. Therefore, there is an ambiguity
problem with yacc and the proposed $ operators when you try to compile the code
yacc generates. So you either have to change yacc, or forget about the $ ops.
Paul van de Graaf U. C. San Diego sdcsvax!sdcc3!85488116
* If you don't know, yacc stands "for yet another compiler compiler" It is a tool
which generates a compiler given a LR(1) grammar and some supporting code that
the programmer writes.
More information about the Comp.lang.c
mailing list