
In the reference manual of K&R2 (2)
Quote:
> Hi...
> I hope that these questions is the final questions about
> the reference manual of K&R2. ^^
> [1] A12.20 Predefined Names (p.233)
> "They (Predefined Names), and also the prepocessor expression operator
> 'defined', may not be undefined or redefined."
> Here, I can't understand that 'defined' may not be undefined or
> redefined. 'defined' is the operator, is it natural not to be able
> to undefine or redefine that? Does it mean that I may not use
> 'defined' as macro name? or what?
'natural' isn't an option.
It means that `#define defined` and `#undef defined` are both illegal.
Quote:
> [2] A13. Grammer (p.234)
> "Besides adding whatever syntactic marking is used to indicate
> alternatives in productions, it is necessary to expand the "one of"
> constructions, and (depending on the rules of the parser-generator)
> to duplicate each production with an 'opt' symbol, once with the
> symbol and once without."
> Plz give me more explanation and practice.
If you want to feed their grammar to a parser-generator, then you will
have to expand the notations it likely doesn't understand.
Thus a rule that says
spoo ::= one of a, b, c, d, e, f
will become one that says
spoo ::= a | b | c | d | e | f
(or, if this is lexical rather than syntactic, may get moved to your
"tokens" section. If you don't understand what I'm talking about, you
probably don't need to know.)
Quote:
> [3] A13. Grammer (p.234)
> "It has only one conflict, generated by the if-else ambiguity."
> I have already known the if-else ambiguity, but I can't understand
> that the grammer produced in A13 has a conflict.
There's a LALR shift-reduce conflict. If you don't know what that
means, then you probably don't *need* to know. (It's just the way
an LR parser-generator such as yacc notices the ambiguity.)
Quote:
> [4] A13. Grammer (p.238)
> "It includes the symbol 'text', which means ordinary program text,
> non-conditional preprocessor control lines, or complete preprocessor
> conditional constructions."
> What are the complete preprocessor conditional constructions?
#if ... #endif
Quote:
> Does it mean that the 'text' could have the nested conditional
> constructions?
yes.
--
Chris "electric hedgehog" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html