digitalmars.D - Various documentation questions
- Bernard Helyer (32/32) Jun 05 2010 I may be trying to write a D2 compiler in D2 (you can't prove
- bearophile (5/11) Jun 05 2010 What is ** for?
- Bernard Helyer (2/13) Jun 05 2010 Sorry, thinking in python. :o
- Bernard Helyer (4/15) Jun 05 2010 I was thinking Python. The exponentiation operator is '^^' and is also
- Ellery Newcomer (34/67) Jun 05 2010 ditto, except mine is in java
- Bernard Helyer (7/76) Jun 05 2010 Okay, I see.
- Ellery Newcomer (18/44) Jun 05 2010 No. Java isn't. :)
- retard (3/14) Jun 06 2010 Why didn't you use some modern JVM language like Clojure or Scala? You
- Ellery Newcomer (6/20) Jun 06 2010 I've thought about using Clojure. I suppose I've just been too lazy to
I may be trying to write a D2 compiler in D2 (you can't prove anything!), 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? --- http://www.digitalmars.com/d/2.0/lex.html#keyword where do the keywords fall? --- 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? --- http://www.digitalmars.com/d/2.0/expression.html#UnaryExpression "( Type ) . Identifier" why is that significant? ---
Jun 05 2010
Bernard Helyer Wrote:I may be trying to write a D2 compiler in D2 (you can't prove anything!), it's early days,:-)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).What is ** for? Bye, bearophile
Jun 05 2010
On 06/06/10 01:27, bearophile wrote:Bernard Helyer Wrote:Sorry, thinking in python. :oI may be trying to write a D2 compiler in D2 (you can't prove anything!), it's early days,:-)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).What is ** for? Bye, bearophile
Jun 05 2010
On 06/06/10 01:22, Bernard Helyer wrote:I may be trying to write a D2 compiler in D2 (you can't prove anything!), 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/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). ---I was thinking Python. The exponentiation operator is '^^' and is also not listed as its own token (I made the same mistake in my lexer as I did in the post! I've got to fix it now! :D).
Jun 05 2010
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 likeclarification 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.
Jun 05 2010
On 06/06/10 03:26, Ellery Newcomer wrote:On 06/05/2010 08:22 AM, Bernard Helyer wrote:Awesome! :)I may be trying to write a D2 compiler in D2 (you can't prove anything!),ditto, except mine is in javaOkay, I see.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.I did not know that. Thanks!--- http://www.digitalmars.com/d/2.0/lex.html#keyword where do the keywords fall?' ' is a token which should be followed by an identifierFunky. Thank you for the example.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; }Maybe I'm having a slow morning, but I can't really grok that. Could you elaborate? Speak slowly. :)--- 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.
Jun 05 2010
On 06/05/2010 08:16 PM, Bernard Helyer wrote:On 06/06/10 03:26, Ellery Newcomer wrote:No. Java isn't. :) Although the jvm talk bearophile linked to suggested that the jvm would be relatively easy to generate machine code for.On 06/05/2010 08:22 AM, Bernard Helyer wrote:Awesome! :)I may be trying to write a D2 compiler in D2 (you can't prove anything!),ditto, except mine is in javaexpressions and types are ambiguous, so any place where both can appear will be trouble. Consider the token string Identifier [ Identifier ] . Identifier does the part before the dot represent a type, or an expression? It's impossible to say at parse time (in the general case), and the programmer will have cause to use both fairly often. And yes, ( Identifier [ Identifier ] ) . Identifier is just as ambiguous, but I think ( Expression ) . Identifier is much less common than Expression . Identifier Ugh. I suppose I'm going to have to write a Type -> Expression routine sometime soon.Maybe I'm having a slow morning, but I can't really grok that. Could you elaborate? Speak slowly. :)--- 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.
Jun 05 2010
Sat, 05 Jun 2010 23:03:34 -0500, Ellery Newcomer wrote:On 06/05/2010 08:16 PM, Bernard Helyer wrote:Why didn't you use some modern JVM language like Clojure or Scala? You hate D's competitors more than Java?On 06/06/10 03:26, Ellery Newcomer wrote:No. Java isn't. :)On 06/05/2010 08:22 AM, Bernard Helyer wrote:Awesome! :)I may be trying to write a D2 compiler in D2 (you can't prove anything!),ditto, except mine is in java
Jun 06 2010
On 06/06/2010 03:15 AM, retard wrote:Sat, 05 Jun 2010 23:03:34 -0500, Ellery Newcomer wrote:I've thought about using Clojure. I suppose I've just been too lazy to bother learning it. Come to think of it though, it would make things much less painful, and I have been wishing for a pattern matching syntax forever. Maybe I will when I have some time.On 06/05/2010 08:16 PM, Bernard Helyer wrote:Why didn't you use some modern JVM language like Clojure or Scala? You hate D's competitors more than Java?On 06/06/10 03:26, Ellery Newcomer wrote:No. Java isn't. :)On 06/05/2010 08:22 AM, Bernard Helyer wrote:Awesome! :)I may be trying to write a D2 compiler in D2 (you can't prove anything!),ditto, except mine is in java
Jun 06 2010