On 06/05/2010 08:22 AM, Bernard Helyer wrote:
I may be trying to write a D2 compiler in D2 (you can't prove
anything!),
ditto, except mine is in java
it's early days, but I've run into a few things I'd like
clarification on. This won't be the last of these posts, I'm sure of it!
*g*
I'm not sure what are bugs, in documentation, in DMD, and in my
understanding.
---
http://www.digitalmars.com/d/2.0/module.html#ModuleDeclaration
"module (system) ModuleFullyQualifiedName ;"
This syntax is not accepted by DMD.
---
http://www.digitalmars.com/d/2.0/module.html#ImportDeclaration
"static import ImportList ;"
is listed specifically, but static can be found under
http://www.digitalmars.com/d/2.0/attribute.html#AttributeSpecifier
which can have a DeclarationBlock afterward, which would include a
single import statement, so surely the former is tautological?
from my reading, I don't think this is the case in dmd. It does
literally parse 'static import'. same with static if, static assert, and
maybe some others. I don't know, but I suspect that stuff like
static public import blah;
wouldn't give you a static import. I also don't know whether it would be
reasonable to make it work like that. The trouble is static means
something else for other declarations.
Something like
static:
...
import blah;
In the parser that I currently have, it would be rather obnoxious to
tell the difference between that and 'static import blah;'. Well, maybe not.
---
http://www.digitalmars.com/d/2.0/lex.html#keyword
where do the @keywords fall?
'@' is a token which should be followed by an identifier
---
http://www.digitalmars.com/d/2.0/lex.html#tokens
There is no '**' token listed. I assume this is an omission (and lex it
as a separate token in SDC, and not two '*'s).
---
http://www.digitalmars.com/d/2.0/expression.html#PostfixExpression
"PostfixExpression . NewExpression"
Where is that valid?
I remember thinking the same thing.
class A{
class B{
string s;
}
int i;
}
void main(){
//A.B b = new A.B; //Error: outer class A 'this' needed to 'new'
nested class B
A a = new A;
A.B b = a.new B;
}
---
http://www.digitalmars.com/d/2.0/expression.html#UnaryExpression
"( Type ) . Identifier"
why is that significant?
---
I suppose it's a bid to reduce the amount of incorrect parsing that
would result from
Type . Identifier
And to its credit, I don't think I have come across any trouble with it.