D grammar oddities

Paul Backus snarwin at gmail.com
Tue Nov 17 22:52:18 UTC 2020


On Tuesday, 17 November 2020 at 22:04:34 UTC, Dibyendu Majumdar 
wrote:
>>
>> Sure - but the issue is the grammar is useless for trying to 
>> understand the language.
>>
>> There is a production Types -> .... But it isn't map to a type.
>>
>> https://dlang.org/spec/grammar.html#types
>
> wrong link - sorry - just look for Type production in the 
> grammar

I assume this is the production you mean:

https://dlang.org/spec/grammar.html#Type

I don't understand why you'd say that this is "useless." It is 
perfectly useful if you want to understand how to refer to a type 
syntactically--for example, in a variable declaration, or when 
passing it as an argument to a template.

Is your complaint that a description of the language's *syntax* 
does not do anything to help you understand its *semantics*? If 
so, that's certainly true, but I'm not sure why you'd expect it 
to. The job of the grammar is only to explain the language's 
syntax. Explaining the semantics of D is what the other pages in 
the language spec are for.


More information about the Digitalmars-d mailing list