Topic: EBNF grammar of C++?
Author: chandu_b@my-deja.com
Date: 2000/07/29 Raw View
Thanks for your reply. I had seen the Stroustrup book description
(Sorry, I should have said that in the original message),
however Stroustrup gives a disclaimer at the top:
"This summary of C++ syntax is intended to be an aid in comprehension.
It is not an exact statement of the language.
In particular, the grammar described here accepts a superset of valid
C++ constructs. Disambiguation and some other rules
must be applied to weed out syntactically valid but meaningless
constructs; distinguish expressions from declarations, etc. etc...."
So, my question is: Is the grammar in the C++ standard the same as in
the book? Or is it an exact EBNF statement?
I suspect it is the latter, it being the standard. But I wanted to be
sure before I spent any money getting hold of the standard.
Also, to be sure again: You don't know of any website where I can look
it up in an electronic format, do you?
Thanks very much!
Chandu
In article <8lqkv8$lb3$1@news.online.de>,
"Sebastian Moleski" <sebmol@gmx.net> wrote:
>
> Hi,
>
> it's part of the C++ Standard. Also, it's printed in Stroustrups
highly
> recommendable book "The C++ Programming Language".
>
> Regards,
>
> Sebastian Moleski
>
> <chandu_b@my-deja.com>:
> >
> > Hi,
> >
> > Does anyone know where I can get hold of the EBNF grammar for C++?
> > I've searched the various FAQs and other newsgroup postings, but
could
> > not find anything like this.
> >
> > No, I'm not writing a new compiler for C++. I would like to access
this
> > for a programming aid tool I'm working on.
Sent via Deja.com http://www.deja.com/
Before you buy.
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Sebastian Moleski" <sebmol@gmx.net>
Date: 2000/08/01 Raw View
<chandu_b@my-deja.com>:
>
> Thanks for your reply. I had seen the Stroustrup book description
> (Sorry, I should have said that in the original message),
> however Stroustrup gives a disclaimer at the top:
>
> "This summary of C++ syntax is intended to be an aid in comprehension.
> It is not an exact statement of the language.
> In particular, the grammar described here accepts a superset of valid
> C++ constructs. Disambiguation and some other rules
> must be applied to weed out syntactically valid but meaningless
> constructs; distinguish expressions from declarations, etc. etc...."
That's what it says in the Standard as well.
> So, my question is: Is the grammar in the C++ standard the same as in
> the book? Or is it an exact EBNF statement?
No. There *is* no exact grammar for the C++ language because nobody ever
came up with one. The problem is that C++ allows too express the same idea
in too many ways so that it's hardly possible to write a grammar that covers
all possibilities while, at the same time, forbids everything else. The
grammar found in Stroustrup's book is exactly the same as in the standard.
> I suspect it is the latter, it being the standard. But I wanted to be
> sure before I spent any money getting hold of the standard.
It's $18 of money well spent.
> Also, to be sure again: You don't know of any website where I can look
> it up in an electronic format, do you?
No, sorry. The Standard (almost) only exists in digital form. If it was
possible to look at it on some web site, you might as well download it from
there. And in that case, there'd be no use in trying to sell it.
I hope I could help you anyway.
Sebastian Moleski
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: chandu_b@my-deja.com
Date: 2000/07/27 Raw View
Hi,
Does anyone know where I can get hold of the EBNF grammar for C++?
I've searched the various FAQs and other newsgroup postings, but could
not find anything like this.
No, I'm not writing a new compiler for C++. I would like to access this
for a programming aid tool I'm working on.
Thanks,
Chandu
Sent via Deja.com http://www.deja.com/
Before you buy.
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Sebastian Moleski" <sebmol@gmx.net>
Date: 2000/07/28 Raw View
Hi,
it's part of the C++ Standard. Also, it's printed in Stroustrups highly
recommendable book "The C++ Programming Language".
Regards,
Sebastian Moleski
<chandu_b@my-deja.com>:
>
> Hi,
>
> Does anyone know where I can get hold of the EBNF grammar for C++?
> I've searched the various FAQs and other newsgroup postings, but could
> not find anything like this.
>
> No, I'm not writing a new compiler for C++. I would like to access this
> for a programming aid tool I'm working on.
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: comeau@panix.com (Greg Comeau)
Date: 2000/08/01 Raw View
In article <8lsmjc$vgr$1@nnrp1.deja.com>, <chandu_b@my-deja.com> wrote:
>Thanks for your reply. I had seen the Stroustrup book description
>(Sorry, I should have said that in the original message),
>however Stroustrup gives a disclaimer at the top:
>
>"This summary of C++ syntax is intended to be an aid in comprehension.
>It is not an exact statement of the language.
>In particular, the grammar described here accepts a superset of valid
>C++ constructs. Disambiguation and some other rules
>must be applied to weed out syntactically valid but meaningless
>constructs; distinguish expressions from declarations, etc. etc...."
>
>So, my question is: Is the grammar in the C++ standard the same as in
>the book? Or is it an exact EBNF statement?
>I suspect it is the latter, it being the standard. But I wanted to be
>sure before I spent any money getting hold of the standard.
I'm not sure what you're trying to obtain, but do note that even if
the summary from C++PL is exactly what's in the standard, that that
description is only for the grammar of the language, and a summary
of it too at that, as it needs English to complete it.
- Greg
--
Comeau Computing / Comeau C/C++ 4.2.42 (4.2.44 expected soon)
TRY Comeau C++ ONLINE at http://www.comeaucomputing.com/tryitout
Email: comeau@comeaucomputing.com / WEB: http://www.comeaucomputing.com
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: bs@research.att.com (Bjarne Stroustrup)
Date: 2000/08/01 Raw View
chandu_b@my-deja.com writes:
> Thanks for your reply. I had seen the Stroustrup book description
> (Sorry, I should have said that in the original message),
> however Stroustrup gives a disclaimer at the top:
>
> "This summary of C++ syntax is intended to be an aid in comprehension.
> It is not an exact statement of the language.
> In particular, the grammar described here accepts a superset of valid
> C++ constructs. Disambiguation and some other rules
> must be applied to weed out syntactically valid but meaningless
> constructs; distinguish expressions from declarations, etc. etc...."
>
> So, my question is: Is the grammar in the C++ standard the same as in
> the book? Or is it an exact EBNF statement?
> I suspect it is the latter, it being the standard. But I wanted to be
> sure before I spent any money getting hold of the standard.
The grammar in my 3rd edition (and in its hardcover "special edition")
is identically to the one in the ISO C++ standard.
My caveat (borowed originally from K&R) applies equally to the standard,
and (like in the standard) the disambiguation and semantic rules are
described in the text.
> Also, to be sure again: You don't know of any website where I can look
> it up in an electronic format, do you?
ANSI sells the standard for $18. Links to a late draft of the standard can
be found on many sites. Links from my C++ page.
- Bjarne
Bjarne Stroustrup - http://www.research.att.com/~bs
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: James Kuyper <kuyper@wizard.net>
Date: 2000/08/01 Raw View
chandu_b@my-deja.com wrote:
....
> So, my question is: Is the grammar in the C++ standard the same as in
> the book? Or is it an exact EBNF statement?
> I suspect it is the latter, it being the standard. But I wanted to be
> sure before I spent any money getting hold of the standard.
What's in the standard is exactly the correct grammar, but I've been
told it falls short of being exactly EBNF. I gather that EBNF can't
quite capture all the relevant details of the C++ grammar, though I
don't know the details.
> Also, to be sure again: You don't know of any website where I can look
> it up in an electronic format, do you?
Follow the links at the bottom of every message posted in the
comp.std.c++ newsgroup; they'll take you to the place where you get an
electronic copy of the standard, for only $18. That money helps support
the standardization effort, so don't begrudge them payment.
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]