D.gnu - hello world compiled
- Ben Hinkle (28/28) Jan 02 2004 Since it's the new year and we all have a few days off I figure'd I'd tr...
- Ilya Minkov (9/16) Jan 02 2004 Woohoo! So you're giving it a try another way around! You shall need a
- Stephan Wienczny (5/42) Jan 03 2004 You did not use the 3.4 branch?!?
- Ben Hinkle (3/7) Jan 03 2004 if I actually get anywhere with it
- Walter (6/12) Jan 03 2004 to
- Ben Hinkle (15/27) Jan 03 2004 try
- Walter (7/15) Jan 03 2004 spew, gotta love it!
Since it's the new year and we all have a few days off I figure'd I'd try to see just how bad it would be to modify the C++ front end to compile D. After one day of search/replace cxx (and cp and tons of other stuff) with dmd and one parser change to recognize "extern (C)" (in parse.y and the wonderfully named file "spew.c") I got hello world to compile and run (linked with libstc++): extern (C) void printf(char*, ...); extern (C) int main(int argc, char**argv) { printf("hello world.\n"); return 0; } [/home/bhinkle/d/gcc/build]845 % ../gcc-3.3.2/configure --enable-languages=c,dmd [snip] [/home/bhinkle/d/gcc/build]846 % make bootstrap [snip] [/home/bhinkle/d/gcc/build]847 % cd gcc [/home/bhinkle/d/gcc/build/gcc]848 % gdmd /home/bhinkle/hello.d -L. -L/home/bhinkle [/home/bhinkle/d/gcc/build/gcc]849 % a.out hello world. Now my goal (something that would actually require work) is to get phobos compiled. It doesn't look like there are any templates in there so templates will wait. I figure I'll run into a brick wall at some point but what the heck. Anyway, I'm not sure how far I'll get but happy new year. -Ben
Jan 02 2004
Ben Hinkle wrote:Since it's the new year and we all have a few days off I figure'd I'd try to see just how bad it would be to modify the C++ front end to compile D. After one day of search/replace cxx (and cp and tons of other stuff) with dmd and one parser change to recognize "extern (C)" (in parse.y and the wonderfully named file "spew.c") I got hello world to compile and run (linked with libstc++):Woohoo! So you're giving it a try another way around! You shall need a lot of good luck in rewriting the C++ front-end, if this really is what you intend to do... I was not going to dig within G++ until i understand and can dump DMD... But i had realized a while ago that i shall for a long while have time for neither. I'm sorry. Good luck and happy new year. -eye
Jan 02 2004
Ben Hinkle wrote:Since it's the new year and we all have a few days off I figure'd I'd try to see just how bad it would be to modify the C++ front end to compile D. After one day of search/replace cxx (and cp and tons of other stuff) with dmd and one parser change to recognize "extern (C)" (in parse.y and the wonderfully named file "spew.c") I got hello world to compile and run (linked with libstc++): extern (C) void printf(char*, ...); extern (C) int main(int argc, char**argv) { printf("hello world.\n"); return 0; } [/home/bhinkle/d/gcc/build]845 % ../gcc-3.3.2/configure --enable-languages=c,dmd [snip] [/home/bhinkle/d/gcc/build]846 % make bootstrap [snip] [/home/bhinkle/d/gcc/build]847 % cd gcc [/home/bhinkle/d/gcc/build/gcc]848 % gdmd /home/bhinkle/hello.d -L. -L/home/bhinkle [/home/bhinkle/d/gcc/build/gcc]849 % a.out hello world. Now my goal (something that would actually require work) is to get phobos compiled. It doesn't look like there are any templates in there so templates will wait. I figure I'll run into a brick wall at some point but what the heck. Anyway, I'm not sure how far I'll get but happy new year. -BenYou did not use the 3.4 branch?!? Do you have a website? Sourceforge project etc? Stephan
Jan 03 2004
You did not use the 3.4 branch?!?umm. whoops. I just got the latest release a few weeks ago or so. I'll check it out.Do you have a website? Sourceforge project etc?if I actually get anywhere with itStephan
Jan 03 2004
"Ben Hinkle" <bhinkle4 juno.com> wrote in message news:bt3thn$2i0a$1 digitaldaemon.com...Since it's the new year and we all have a few days off I figure'd I'd trytosee just how bad it would be to modify the C++ front end to compile D.That is an interesting approach. It just might work!Now my goal (something that would actually require work) is to get phobos compiled. It doesn't look like there are any templates in there sotemplateswill wait. I figure I'll run into a brick wall at some point but what the heck.D templates are easy - it's entirely handled within the front-end.
Jan 03 2004
"Walter" <walter digitalmars.com> wrote in message news:bt7qeh$294u$2 digitaldaemon.com..."Ben Hinkle" <bhinkle4 juno.com> wrote in message news:bt3thn$2i0a$1 digitaldaemon.com...trySince it's the new year and we all have a few days off I figure'd I'dtoI added alias and uchar, ushort and friends with no problem but my next goal was dynamic arrays and that has been harder. I haven't figured out enough about the G++ front end to make any real progress on that. It turns out the C notion of arrays is pretty hard-wired into gcc. Also I started ripping out the preprocessor but that caused havoc in the parse and lex code (and that lovely spew.c). Right now I'm looking at plugging in your lexer since it has the least dependencies on anything else and is *much* simpler than the G++ cpp-based lexer. I'm starting to think my approach will end up as a rather extensive transplant of certain G++ chunks with the DMD equivalents.see just how bad it would be to modify the C++ front end to compile D.That is an interesting approach. It just might work!phobosNow my goal (something that would actually require work) is to getthecompiled. It doesn't look like there are any templates in there sotemplateswill wait. I figure I'll run into a brick wall at some point but whateasy, eh? Don't get my hopes up ;-)heck.D templates are easy - it's entirely handled within the front-end.
Jan 03 2004
"Ben Hinkle" <bhinkle4 juno.com> wrote in message news:bt84h2$2n84$1 digitaldaemon.com...Also I started ripping out the preprocessor but that caused havoc in the parse and lex code (and that lovely spew.c).spew, gotta love it!Right now I'm looking at plugging in your lexer since it has the least dependencies on anything else and is *much* simpler than the G++ cpp-based lexer.I had the advantage here because whenever the D lexer started looking complicated, I simplified the language. Suggest simplifying the C++ language to make scanning easier, and one's compiler cajones get questioned <g>.Once you get the rest of the DMD front end in, it should be easy!D templates are easy - it's entirely handled within the front-end.easy, eh? Don't get my hopes up ;-)
Jan 03 2004