www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [Suggestion] Full D BNF in one place

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
At the moment, the BNF of the D language is scattered about the 
documentation, and there are bits missing.

We ought to round up the full BNF grammar and publish it in one place. 
This would make it easier:
- to see if the grammar is complete, and hence work towards getting the 
D spec up to scratch
- to look at a sample piece of code and see if it's syntactically valid 
- to clear up misunderstandings/misreadings of the spec, which have led 
to arguments here over whether a piece of code is syntactically valid
- for D compiler writers to write a correct parsing algorithm

Maybe we could start rounding it up on Wiki4D.  I suggest that we have a 
main page with subpages for different aspects of the D grammar.  Each 
would start as a direct copy of the grammar as given on the Digital Mars 
site, and provide room for corrections and omissions to be pointed out.

And we should include on the relevant pages the disambiguation rules, 
for example:
- the classic if-if-else issue
- if it's parseable as a DeclarationStatement then it's a 
DeclarationStatement....

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
Jun 23 2005
parent reply Manfred Nowak <svv1999 hotmail.com> writes:
Stewart Gordon <smjg_1998 yahoo.com> wrote:

 At the moment, the BNF of the D language is scattered about the 
 documentation, and there are bits missing.
[...] I have filed bugs on this at least twice---and you forget that the docs are contradictory on some elements of the language. I am unable to read the tricks that digitalmars is using out of the code and have not received any answers on my claims that the grammar is incomplete: so i believe that digitalmars is - not interested or - unable to give the complete unambiguated grammar. -manfred
Jun 25 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Manfred Nowak wrote:
 Stewart Gordon <smjg_1998 yahoo.com> wrote:
 
 At the moment, the BNF of the D language is scattered about the 
 documentation, and there are bits missing.
[...] I have filed bugs on this at least twice---and you forget that the docs are contradictory on some elements of the language.
Forget? How do you work that out?
 I am unable to read the tricks that digitalmars is using out of the 
 code
I wasn't expecting anybody to reverse engineer the grammar out of the compiler. Simply to work towards getting the grammar of the _language_ properly documented. Though we probably ought to make notes of compiler bugs while we're at it.
 and have not received any answers on my claims that the 
 grammar is incomplete: so i believe that digitalmars is
 - not interested or
 - unable
 to give the complete unambiguated grammar. 
Either is a problem in itself. If unable, then they're also unable to write a correct D compiler. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jun 30 2005
parent reply Manfred Nowak <svv1999 hotmail.com> writes:
Stewart Gordon <smjg_1998 yahoo.com> wrote:

 you forget that the docs are contradictory on some elements of
 the language. 
Forget? How do you work that out?
I conclude it from your not mentioning it.
 I wasn't expecting anybody to reverse engineer the grammar out
 of the compiler.
There is no entry in the specs on what is allowed in a functionbody. I considered a short look into the code as helpful, but it is not. -manfred
Jun 30 2005
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Manfred Nowak wrote:
 Stewart Gordon <smjg_1998 yahoo.com> wrote:
 
you forget that the docs are contradictory on some elements of
the language. 
Forget? How do you work that out?
I conclude it from your not mentioning it.
You mean you expected my last post to be a complete brain dump?
I wasn't expecting anybody to reverse engineer the grammar out
of the compiler.
There is no entry in the specs on what is allowed in a functionbody. I considered a short look into the code as helpful, but it is not.
That's half my point - to help get the spec complete. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jun 30 2005