|> In article <
[email protected]>,
|> :The *parser*, when it see the "return;", doesn't remember what type
|> :the containing function returns. The distinction between a valid
|> :"return;" in a void function, and an invalid "return;" in an int
|> :function, cannot be made by the parser. It can only be made during
|> :semantic analysis.
|> Then the presence
|> of the word 'void' followed by an identifier followed by
|> one of the argument declaration forms, followed by a '{' intead of
|> a ';', places one -syntactically- inside a void function. At that
|> point, whether 'return' is followed by something other than ';'
|> is a matter of syntax.
|If you look at the syntax definition for a function-definition:
|you'll see that it doesn't distinguish between void and non-void
|functions.
If you look at what you wrote, you said that certain kinds of
validity checks on 'return' statements "cannot be made by the
parser" and "can only be made during semantics analysis".
I showed that this is incorrect: that once past preprocessing,
a parser *could* syntatically determine whether a void function
had a non-void return.
I did not say that a parser -must- so determine, and I didn't
say that there was a distinction at the BNF level: I just pointed
out that the recognition *could* be made by the parser.
If you had written that the distinction "is not" made by the parser
then you would be talking about implimentation, and might be correct
for all existing parsers -- but you wrote "cannot", which means
"not possible", and I showed that at least part of it is possible.