October 03, 2004 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Senji | "Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:cjmnps$2nsm$1@digitaldaemon.com... > BTW: I am not that great at understanding licenses, and i was wondering if the license would permit translating D's lexer to D and changing it to fit my needs? (The lexer i use is really idiotic) Yes. |
October 03, 2004 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Senji | Ivan Senji wrote: > BTW: I am not that great at understanding licenses, and i was wondering > if the license would permit translating D's lexer to D and changing it to > fit my needs? (The lexer i use is really idiotic) With respect to that... awhile ago, I wrote a little Python script to convert a certain subset of C++ (that which is used by DMD) to D. It handles most everything I've tested it on. (#ifdef, pointers, arrays, etc) To use it, just pass the name of the .c/.h pair as an argument, eg: python c2d.py expression It will parse expression.c and expression.h, and produce expression.d. Maybe it will save you some time. :) <http://andy.tadan.us/d/c2d.py> -- andy |
October 04, 2004 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | "Andy Friesen" <andy@ikagames.com> wrote in message news:cjpb7g$170u$1@digitaldaemon.com... > Ivan Senji wrote: > > BTW: I am not that great at understanding licenses, and i was wondering if the license would permit translating D's lexer to D and changing it to > > fit my needs? (The lexer i use is really idiotic) > > With respect to that... > > awhile ago, I wrote a little Python script to convert a certain subset > of C++ (that which is used by DMD) to D. It handles most everything > I've tested it on. (#ifdef, pointers, arrays, etc) > > To use it, just pass the name of the .c/.h pair as an argument, eg: > > python c2d.py expression > > It will parse expression.c and expression.h, and produce expression.d. > > Maybe it will save you some time. :) > > <http://andy.tadan.us/d/c2d.py> > Thanks. I am sory that i don't have more time so i can explore python because i have never used it before, so when i do get some free time i think it will be easier for me to convert Walter's lexer from C++ to D. > -- andy |
October 10, 2004 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Senji | On Thu, 30 Sep 2004 22:07:50 +0200, Ivan Senji wrote:
> I am writing a preprocessor for D that can add new syntaxes to D,
so can we do ctor() instead of this()?
and the postfix var.cast(TYPE) ?
;)
Ant
|
October 10, 2004 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | "Ant" <duitoolkit@yahoo.ca> wrote in message news:pan.2004.10.10.16.18.26.147697@yahoo.ca... > On Thu, 30 Sep 2004 22:07:50 +0200, Ivan Senji wrote: > > > I am writing a preprocessor for D that can add new syntaxes to D, > > so can we do ctor() instead of this()? > and the postfix var.cast(TYPE) ? Well i like this so the first answer is no ;)- I'm going to do the postfix cast these days. And add it to dsource, it will be part of lr-lalr project. So anyone can add things. > > ;) > > Ant > |
October 11, 2004 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Senji | In article <cjhp3l$1coi$1@digitaldaemon.com>, Ivan Senji says... > >I am writing a preprocessor for D that can add new syntaxes to D, >and have implemented noreturn statement that basically throws >an exception >int func(int x) >{ > if(x>0){} > else if(x<0){} > noreturn; > //or noreturn("Some message"); >} > >and another iterating construct i call each, It is used like this: int[] numbers; > >(each numbers)++; > >and translated to >for(int index=0;index<numbers.length; index++) >{ > numbers[index]++; >} > >You can also specify an index: > >(each[int i] numbers) = i*i; >=== >for(int i=0;i<numbers.length; i++) >{ > numbers[i]=i*i; >} > >Or use it in function calls >writef("\n",(each numbers)); > >But now my brain has stopped and i can't figure out how >this should work for a multidimensional case? >int[][] a; //initialized somwhere >sum += (each[int x,int y] a); >//or should it be each[int y,int x] > >This should translate to what? >for(int y=0;y<a.length; y++) >{ > for(int x=0;x<a[y].length;x++) > { > sum+= a[x][y]; > } >} > >Is this correct or did i get the indexes wrong? Should x and y be the other way around? Comments? > > > > > > > This is very cool! A substitute for array arith ops till 2.0 maybe :) ? Lots of other cool uses Im sure. Where can we get it ? X |
October 11, 2004 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to X | "X" <X_member@pathlink.com> wrote in message news:ckebi9$1msk$1@digitaldaemon.com... > > This is very cool! A substitute for array arith ops till 2.0 maybe :) ? Lots > of other cool uses Im sure. Thanks. Each looks like a good substitute for array ops. > Where can we get it ? It will be added to lr-lalr parser project on dsource in a couple of days but it is still mostly a toy because i don't have much time to conect it to a real lexer (like Walter's). > > X > > |
July 29, 2005 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | hey is there any chance i can get this c2d.py from someone? http://andy.tadan.us/d/c2d.py the site longer exists Andy Friesen wrote: > Ivan Senji wrote: > >> BTW: I am not that great at understanding licenses, and i was wondering >> if the license would permit translating D's lexer to D and changing it to >> fit my needs? (The lexer i use is really idiotic) > > > With respect to that... > > awhile ago, I wrote a little Python script to convert a certain subset of C++ (that which is used by DMD) to D. It handles most everything I've tested it on. (#ifdef, pointers, arrays, etc) > > To use it, just pass the name of the .c/.h pair as an argument, eg: > > python c2d.py expression > > It will parse expression.c and expression.h, and produce expression.d. > > Maybe it will save you some time. :) > > <http://andy.tadan.us/d/c2d.py> > > -- andy |
July 29, 2005 Re: Extending syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to J Thomas | In article <dcdr7u$1vcq$1@digitaldaemon.com>, J Thomas says... > >hey is there any chance i can get this c2d.py from someone? > >http://andy.tadan.us/d/c2d.py > >the site longer exists Well, Andy's URL is now http://aegisknight.org/~andy/d/, but I'm not sure if that particular file is there since I'm having trouble reaching his website right now. I don't know if the server is overloaded or if the server is just ticked off at me. If the file isn't at the new website, I should have it burned onto a CD at home. If I remember, I'll try to find it this weekend. jcc7 |
Copyright © 1999-2021 by the D Language Foundation