Topic: Defect report: No grammar sentence symbol


Author: brangdon@cix.compulink.co.uk (Dave Harris)
Date: Tue, 12 Dec 2000 21:02:43 GMT
Raw View
mike@dimmick.demon.co.uk (Mike Dimmick) wrote (abridged):
> PLEASE, in the next version of the standard, can we have a proper,
> full, Extended BNF grammar.

Do you want to turn this into a "Feature Request", so that it doesn't get
overlooked when the next standard is done?

  Dave Harris, Nottingham, UK | "Weave a circle round him thrice,
      brangdon@cix.co.uk      |   And close your eyes with holy dread,
                              |  For he on honey dew hath fed
 http://www.bhresearch.co.uk/ |   And drunk the milk of Paradise."

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Martin von Loewis <loewis@informatik.hu-berlin.de>
Date: Fri, 15 Dec 2000 14:08:50 GMT
Raw View
"Mike Dimmick" <mike@dimmick.demon.co.uk> writes:

> It makes it too damned hard to write a parser [1] for it, that's what!
>
> PLEASE, in the next version of the standard, can we have a proper,
> full, Extended BNF grammar.  The current one is very long-winded and
> messy, and in a few places, self-contradictory.  I could understand
> it if this were a commercial product owned by a single supplier,
> where they might wish to discourage compilers from being written,
> but C++ is supposed to be standard.

I don't think that providing an EBNF would simplify anybody's life.
If you feel the notation used in the standard should be BNF, not
suffix-opt-alternatives-in-multiple-lines - well, that's the least
problem of a compiler writer, I can well imagine a tool that extracts
the grammar in ISO 14882 and converts it into BNF.

The other problem is that lexical analysis needs to interact with the
symbol table, to tell apart typenames and identifiers. I firmly
believe that this cannot be corrected without changing the language
itself (rather than changing just the grammar presentation): The
meaning of

  a*b;

depends on whether a is a type or not - this then becomes either a
declaration or an expression. That is indeed beyond what you can
express in EBNF.

Regards,
Martin

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: fjh@cs.mu.OZ.AU (Fergus Henderson)
Date: Mon, 11 Dec 2000 17:42:55 GMT
Raw View
Martin von Loewis <loewis@informatik.hu-berlin.de> writes:

>remove.haberg@matematik.su.se (Hans Aberg) writes:
>
>> The funny thing is that without the a sentence symbol S, the language
>> cannot be generated: It is not possible to look at (T, N, P) only and from
>> that derive L or S.
>
>No, and in C++, that wouldn't even be possible with that
>information. The C++ grammar, apparently, is not a formal grammar. So
>what?

If you give it a proper start symbol, then the grammar given in the
standard *is* a formal grammar.  It accepts a superset of the C++
language, since some of the requirements on well-formed programs are
specified via semantic constraints, rather than syntax rules, and it
is an ambiguous grammar (in some cases you need to apply
disambiguation rules to get an unambiguous parse), but it is
nevertheless still a formal grammar (minus start symbol), and still
useful.

--
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: "Mike Dimmick" <mike@dimmick.demon.co.uk>
Date: Tue, 12 Dec 2000 14:38:30 GMT
Raw View
"Martin von Loewis" <loewis@informatik.hu-berlin.de> wrote in message
news:p6qg0jxalsz.fsf@informatik.hu-berlin.de...
> remove.haberg@matematik.su.se (Hans Aberg) writes:
>
> > The funny thing is that without the a sentence symbol S, the language
> > cannot be generated: It is not possible to look at (T, N, P) only and
from
> > that derive L or S.
>
> No, and in C++, that wouldn't even be possible with that
> information. The C++ grammar, apparently, is not a formal grammar. So
> what?

It makes it too damned hard to write a parser [1] for it, that's what!

PLEASE, in the next version of the standard, can we have a proper, full,
Extended BNF grammar.  The current one is very long-winded and messy, and in
a few places, self-contradictory.  I could understand it if this were a
commercial product owned by a single supplier, where they might wish to
discourage compilers from being written, but C++ is supposed to be standard.

BNF was invented for the Algol 60 report, IIRC.  I think it's sufficiently
well known and documented in compiler textbooks and papers that it _should_
have been used.  The extended BNF is very helpful in writing recursive
descent parsers.

--
Mike Dimmick

[1]  I'm a final year computing science student, and my project is to
produce a documentation generation tool for C++ programs (generating class
diagrams in UML).  The syntax of C++ is _very_ nice to write programs in,
but as I'm discovering, is quite hard to parse - lack of director symbols
mostly causes this, meaning that every identifier's meaning has to be
determined before the parser can make a decision which way to go.  In Noam
Chomsky's terms, I think this makes it a class 2, or context-sensitive,
grammar.

Pascal, Ada, etc, all seem to have (mostly) context-free grammars, meaning
that semantic analysis can be (almost) fully separated from syntactic
analysis.  The price is paid by the users of the language, in having to
write lots of director symbols that otherwise don't really contribute to the
program.  I think the C++ balance is the right way around, but the grammar
as specified makes it harder to write a parser than it should be.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Martin von Loewis <loewis@informatik.hu-berlin.de>
Date: Sun, 10 Dec 2000 00:11:20 GMT
Raw View
remove.haberg@matematik.su.se (Hans Aberg) writes:

> The funny thing is that without the a sentence symbol S, the language
> cannot be generated: It is not possible to look at (T, N, P) only and from
> that derive L or S.

No, and in C++, that wouldn't even be possible with that
information. The C++ grammar, apparently, is not a formal grammar. So
what?

Regards,
Martin

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: James Kuyper <kuyper@wizard.net>
Date: 2000/12/06
Raw View
Hans Aberg wrote:
>
> In article <3A2C3B86.A3868A69@wizard.net>, James Kuyper
> <kuyper@wizard.net> wrote:
> >> Nevertheless, I think it would still be clearer if Appendix A,
> >> which is supposed to summarize the grammar, included all the relevant
> >> information.
> >
> >It does: see section A.3p1.
>
> It does not say that  translation-unit  is a sentence symbol. In addition,

True. It is a sentence symbol, but not explicitly identified as such.
However, I was addressing Fergus' issue, namely the absence of a summary
of section 3.5 in the appendix. You could hardly expect the summary to
say something that even the original fails to mention.

> C++ is built up of two grammars, having different sentence symbols, the
> other one being  preprocessing-file.

You may remember that I was one of the ones who told you that.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: 2000/12/06
Raw View
In article <3A2D9346.D4111418@wizard.net>, James Kuyper
<kuyper@wizard.net> wrote:
>Hans Aberg wrote:
>> ...C++ is built up of two grammars, having different sentence symbols,
[one veing translation-unit] the
>> other one being  preprocessing-file.

>You may remember that I was one of the ones who told you that.

I am not polemizing with you: Thank you very much, and others in this
thread that helped identifying the C++ grammar. It is very helpful for me
when getting for my own OOPL, both as input for ideas, and for the parst
oof my syntax that admits C++ includes and sometimes needs to copy C++
constructs.

Otherwise, to make a long story short, I tried for a practical purpose
read the C++ grammar, but I could not do it, because Appendix A does not
identify the two sentence symbols that C++ uses in its two grammars. It is
clearly a mathematical defect, rather regardless one wants to call it in
C++ standarization lingo, and rather unhelpful to the readers of the
standard.

So the next time, let's see some improvement: Include the sentence symbols
clearly identified, with some pointers to the main body, please. The main
body needs to say explicitly that these are the sentence (start) symbols
of the grammars that C++ uses too.

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: fjh@cs.mu.OZ.AU (Fergus Henderson)
Date: 2000/12/04
Raw View
comeau@panix.com (Greg Comeau) writes:

>In article <remove.haberg-0112001059550001@du136-226.ppp.su-anst.tninet.se>,
>Hans Aberg <remove.haberg@matematik.su.se> wrote:
>> [Moderator's note: this defect report has been
>> forwarded to the C++ committee. -moderator(fjh).]
>>
>>The C++ standard Appendix A grammar does not seem to indicate a grammar
>>sentence symbol: So formally it is not a grammr. And so it seems that this
>>is a defect of the report.
>>
>>Which is the C++ grammar sentence symbol?
>
>If I understand you, that's just fine and NAD,
>as that's covered elsewhere.

Specifically in 3.5 [basic.link] paragraph 1.

Nevertheless, I think it would still be clearer if Appendix A,
which is supposed to summarize the grammar, included all the relevant
information.

--
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: James Kuyper <kuyper@wizard.net>
Date: 2000/12/04
Raw View
Hans Aberg wrote:
...
> What do you mean? A grammar always has a sentence symbol. The stuff in
> Appendix A called a "grammar" does not seem to have it; thus it is not
> mathematically a grammar, but something else. If the C++ standard invents
> its own non-standard mathematical concepts, should they not be specified?
>
> If the sentence symbol of the C++ grammar is mentioend somewhere else in
> the standard specification, where? -- The thing is that I need it for
> writing my own OOPL, that's why I'm asking.

One of the complexities of C++ is that there's basically two separate
interacting grammars, one for preprocessing (phase 4), and another for
syntactic analysis (phase 7). The sentence symbol for the preprocessing
phase in C++ would be _preprocessing-file_, defined in 16p1. The
sentence symbol for the processing phase in C++ would be
_translation-unit_, defined in 3.5p1.

It's not clear to me that the C++ "grammar" is intended to meet any
particular mathematical requirements for a grammar. The syntax notation
used in the C++ standard is defined in section 1.6; unless you find
either an internal inconsistency in section 1.6, or a deviation in the
rest of the document from the notation described in 1.6, I don't think
it would qualify as a defect. Note also that Annex A states explicitly
that the grammar is "an aid to comprehension ... not an exact statement
of the language".

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: comeau@panix.com (Greg Comeau)
Date: 2000/12/04
Raw View
In article <remove.haberg-0312001120430001@du133-226.ppp.su-anst.tninet.se>,
Hans Aberg <remove.haberg@matematik.su.se> wrote:
>In article <90b27d$qbv$1@panix3.panix.com>, comeau@comeaucomputing.com wrote:
>>>The C++ standard Appendix A grammar does not seem to indicate a grammar
>>>sentence symbol: So formally it is not a grammr. And so it seems that this
>>>is a defect of the report.
>>>
>>>Which is the C++ grammar sentence symbol?
>>
>>If I understand you, that's just fine and NAD,
>>as that's covered elsewhere.
>
>What do you mean? A grammar always has a sentence symbol. The stuff in
>Appendix A called a "grammar" does not seem to have it; thus it is not
>mathematically a grammar, but something else. If the C++ standard invents
>its own non-standard mathematical concepts, should they not be specified?
>
>If the sentence symbol of the C++ grammar is mentioend somewhere else in
>the standard specification, where? -- The thing is that I need it for
>writing my own OOPL, that's why I'm asking.

This all seems independent of writing an OOPL or not.

I don't have my Standard C++ handy, but I'm certain that
Appendix A is labelled "informative" and mentioned that extra
things are needed in order to describe the language more completely.

Anyway, if by "sentence symbol" you mean like a start symbol,
well, C++ is comprised of declarations, which the "compiler proper"
sees through translation units.  I'm certain that's in the
grammar in Appendix A (and in words elsewhere), even though it
it isn't denoted by "S" or something like that.

- Greg
--
Comeau Computing / Comeau C/C++ "so close" 4.2.44 betas NOW AVAILABLE
TRY Comeau C++ ONLINE at http://www.comeaucomputing.com/tryitout
Email: comeau@comeaucomputing.com / WEB: http://www.comeaucomputing.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: James Kuyper <kuyper@wizard.net>
Date: Tue, 5 Dec 2000 00:55:02 GMT
Raw View
Fergus Henderson wrote:
...
> >Hans Aberg <remove.haberg@matematik.su.se> wrote:
...
> >>Which is the C++ grammar sentence symbol?
...
> Specifically in 3.5 [basic.link] paragraph 1.
>
> Nevertheless, I think it would still be clearer if Appendix A,
> which is supposed to summarize the grammar, included all the relevant
> information.

It does: see section A.3p1.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: 2000/12/05
Raw View
In article <90gdvs$e14$1@panix3.panix.com>, comeau@comeaucomputing.com wrote:
>>If the sentence symbol of the C++ grammar is mentioned somewhere else in
>>the standard specification, where? -- The thing is that I need it for
>>writing my own OOPL, that's why I'm asking.
>
>This all seems independent of writing an OOPL or not.

I wanted to read grammar to get an input for my the grammar I need to
construct for my own OOPL. Thus I needed to find the sentence symbol in
order to read the C++ grammar.

>I don't have my Standard C++ handy, but I'm certain that
>Appendix A is labelled "informative" and mentioned that extra
>things are needed in order to describe the language more completely.
>
>Anyway, if by "sentence symbol" you mean like a start symbol,
>well, C++ is comprised of declarations, which the "compiler proper"
>sees through translation units.  I'm certain that's in the
>grammar in Appendix A (and in words elsewhere), even though it
>it isn't denoted by "S" or something like that.

The other posts in this thread have given some indications of the situation.

Otherwise a grammar formally is a quadruple (T, N, P, S), where T and S
are two disjoint sets called terminals and non-terminals, their union V
called variables; P a set productions, pairs (a, b), where a in V+ (set of
non-zero finite sequences of V), and b in V* (set of possibly zero
sequences of V), and S in N is the sentence symbol: The language L
produced by (T, N, P, S) is the subset of T* generated from S by
application of the productions in P.

The funny thing is that without the a sentence symbol S, the language
cannot be generated: It is not possible to look at (T, N, P) only and from
that derive L or S.

In article <3A2B3610.93260E98@wizard.net>, James Kuyper
<kuyper@wizard.net> wrote:
>One of the complexities of C++ is that there's basically two separate
>interacting grammars, one for preprocessing (phase 4), and another for
>syntactic analysis (phase 7). The sentence symbol for the preprocessing
>phase in C++ would be _preprocessing-file_, defined in 16p1. The
>sentence symbol for the processing phase in C++ would be
>_translation-unit_, defined in 3.5p1.

Thank you for the input.

But the complexity of the grammar is not an issue here: One gets context
and semantic dependencies, which are normal problems when dealing with
grammars.

>It's not clear to me that the C++ "grammar" is intended to meet any
>particular mathematical requirements for a grammar.
...
> Note also that Annex A states explicitly
>that the grammar is "an aid to comprehension ... not an exact statement
>of the language".

The question is not whether this is a grammar useable together with the
rest of the standard, but whether it is a grammar at all. Clearly, it is
not, as it stands.

> The syntax notation
>used in the C++ standard is defined in section 1.6; unless you find
>either an internal inconsistency in section 1.6, or a deviation in the
>rest of the document from the notation described in 1.6, I don't think
>it would qualify as a defect.

So this is not an issue: There is no problem with the notation used in
order to describe terminals and non-terminals.

Anyway, it seems that C++ makes use of two grammars, one for
preprocessing, having the sentence symbol, defined in 16#1, and the
resulting output is sent to another language with sentence symbol
translation-unit, defined in 3.5#1.

In article <90es6e$tr7$1@nnrp1.deja.com>, Cesar Quiroz
<cesar_quiroz@my-deja.com> wrote:
>A.3
>
>translation-unit:
>   declaration-seq[opt]
>
>You'll notice that A1 and A2 deal with largely lexical matters, so I
>would expect the first syntactic rule to be named after them (the above
>one) to guide the parsing.  Notice also the disclaimer at the beginning
>of the Annex.  2p1 makes looking for "translation unit" relevant.
>Therefore, not a defect, just another aspect of the text that requires
>very careful reading.

(Thanks for the info.) Well, there is a defect in Appendix A in that what
is claimed to be a grammar is not a grammar as it stands.

>Disclaimer or not, the above rule permits empty translation units.  I
>may have an old prejudice against them -- I vaguely recall them being
>illegal in C89 or some such old language.  Not anymore?  The grammar in
>Stroustrup 3 SE says the same, so it must be on purpose.

So it seems. My compiler does not complain.

In article <90co47$nq4$1@mulga.cs.mu.OZ.AU>, fjh@cs.mu.OZ.AU (Fergus
Henderson) wrote:
>Nevertheless, I think it would still be clearer if Appendix A,
>which is supposed to summarize the grammar, included all the relevant
>information.

And pointers to the relevant sections, so that relying on comp.std.c++
isn't necessary. :-)

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: fjh@cs.mu.OZ.AU (Fergus Henderson)
Date: 2000/12/05
Raw View
James Kuyper <kuyper@wizard.net> writes:

>Fergus Henderson wrote:
>...
>> >Hans Aberg <remove.haberg@matematik.su.se> wrote:
>...
>> >>Which is the C++ grammar sentence symbol?
>...
>> Specifically in 3.5 [basic.link] paragraph 1.
>>
>> Nevertheless, I think it would still be clearer if Appendix A,
>> which is supposed to summarize the grammar, included all the relevant
>> information.
>
>It does: see section A.3p1.

You mean the following text?

| translation-unit:
|        declaration-seqopt

That's certainly not as clear as it could be, since it doesn't
actually say that "translation-unit" is the start symbol.

--
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: 2000/12/05
Raw View
In article <3A2C3B86.A3868A69@wizard.net>, James Kuyper
<kuyper@wizard.net> wrote:
>> Nevertheless, I think it would still be clearer if Appendix A,
>> which is supposed to summarize the grammar, included all the relevant
>> information.
>
>It does: see section A.3p1.

It does not say that  translation-unit  is a sentence symbol. In addition,
C++ is built up of two grammars, having different sentence symbols, the
other one being  preprocessing-file.

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: 2000/12/05
Raw View
In article <90hqo9$r4n$1@mulga.cs.mu.OZ.AU>, fjh@cs.mu.OZ.AU (Fergus
Henderson) wrote:
>>> Nevertheless, I think it would still be clearer if Appendix A,
>>> which is supposed to summarize the grammar, included all the relevant
>>> information.
>>
>>It does: see section A.3p1.
>
>You mean the following text?
>
>| translation-unit:
>|        declaration-seqopt
>
>That's certainly not as clear as it could be, since it doesn't
>actually say that "translation-unit" is the start symbol.

There is one simple way out of it, namely to exclude the word "grammar"
entirely, and only speak about "syntax rules". Thus Appendix A will called
"Syntax Rules Summary" etc.

However, this solution is somewhat corny, because if one should be able to
use the Appendix A for a quick reference, and be able to read the C++
grammar, it is better to indicate the sentence symbols with some
references of where they are defined in the body of the standard.

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: 02 Dec 00 05:21:28 GMT
Raw View
 [Moderator's note: this defect report has been
 forwarded to the C++ committee. -moderator(fjh).]

The C++ standard Appendix A grammar does not seem to indicate a grammar
sentence symbol: So formally it is not a grammr. And so it seems that this
is a defect of the report.

Which is the C++ grammar sentence symbol?

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]




Author: comeau@panix.com (Greg Comeau)
Date: 2000/12/02
Raw View
In article <remove.haberg-0112001059550001@du136-226.ppp.su-anst.tninet.se>,
Hans Aberg <remove.haberg@matematik.su.se> wrote:
> [Moderator's note: this defect report has been
> forwarded to the C++ committee. -moderator(fjh).]
>
>The C++ standard Appendix A grammar does not seem to indicate a grammar
>sentence symbol: So formally it is not a grammr. And so it seems that this
>is a defect of the report.
>
>Which is the C++ grammar sentence symbol?

If I understand you, that's just fine and NAD,
as that's covered elsewhere.

- Greg
--
Comeau Computing / Comeau C/C++ "so close" 4.2.44 betas NOW AVAILABLE
TRY Comeau C++ ONLINE at http://www.comeaucomputing.com/tryitout
Email: comeau@comeaucomputing.com / WEB: http://www.comeaucomputing.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: 2000/12/03
Raw View
In article <90b27d$qbv$1@panix3.panix.com>, comeau@comeaucomputing.com wrote:
>>The C++ standard Appendix A grammar does not seem to indicate a grammar
>>sentence symbol: So formally it is not a grammr. And so it seems that this
>>is a defect of the report.
>>
>>Which is the C++ grammar sentence symbol?
>
>If I understand you, that's just fine and NAD,
>as that's covered elsewhere.

What do you mean? A grammar always has a sentence symbol. The stuff in
Appendix A called a "grammar" does not seem to have it; thus it is not
mathematically a grammar, but something else. If the C++ standard invents
its own non-standard mathematical concepts, should they not be specified?

If the sentence symbol of the C++ grammar is mentioend somewhere else in
the standard specification, where? -- The thing is that I need it for
writing my own OOPL, that's why I'm asking.

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: Cesar Quiroz <cesar_quiroz@my-deja.com>
Date: 2000/12/04
Raw View
A.3

translation-unit:
   declaration-seq[opt]

You'll notice that A1 and A2 deal with largely lexical matters, so I
would expect the first syntactic rule to be named after them (the above
one) to guide the parsing.  Notice also the disclaimer at the beginning
of the Annex.  2p1 makes looking for "translation unit" relevant.
Therefore, not a defect, just another aspect of the text that requires
very careful reading.

Disclaimer or not, the above rule permits empty translation units.  I
may have an old prejudice against them -- I vaguely recall them being
illegal in C89 or some such old language.  Not anymore?  The grammar in
Stroustrup 3 SE says the same, so it must be on purpose.


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]