Sorry for repeating, but I haven't understood why the semantics is
restricted by the definition method of the syntax yet.
The standard says "all semantic requirements are described only in
textual form".
Are you familiar with YACC? And with the difficulty of parsing C++
(that some lexemes are context dependent, depending upon the semantics
of the context)?
That's the kind of thing that phrase is talking about -- cases where
the "syntax" (in the informal, broad sense of the word) isn't
completely described by the syntax of the grammar. Those additional
"semantic requirements" _on_the_grammar_ are described only in the
text.
Another way to put that is, suppose you write a yacc grammar. You
could put in "actions" (in the yacc sense). Some of those actions
could reject things that the grammar would otherwise parse.
That phrase is saying, in effect, the grammars in the spec don't
contain any actions -- all that matter is only described in the text.
In other words, to understand what legal constructs are in any of the
languages, you have to not only read the grammar, but also read the
text.
Or in other words, just because the grammar says some construct is
syntactically legal doesn't mean it is really part of the language --
you have to also check the text for any additional "semantic
requirements". A regexp example is that:
[z-a]
though accepted by the grammar, is not a legal regexp. There's a
semantic requirement in the text that makes it illegal.
That phrase doesn't mean "The semantic explanation of the meaning of
regexps is completely independent of the grammar used to explain their
syntax."
-t
|