www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - DMD front end starter kit

reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
I started a few project that needed the dmd front end code so I got the 
source for the DMD front-end into a standalone form and have put it on my 
website as a "starter kit" for others to build D parsers and analyzers. Get 
it at
http://home.comcast.net/~benhinkle/dmdfe
There is a pre-built program that just prints debugging parsing and semantic 
information but that program by itself is not very useful. Hopefully it will 
be easy for people to customize for different tools but if there's something 
I can do to improve the starter kit let me know.

Currently only Windows is supported (but that's probably just becuase I 
haven't made a Makefile for Linux yet). The project is GPL.

Happy Tooling!

-Ben 
Apr 01 2005
next sibling parent reply "Charlie" <charles jwavro.com> writes:
Coolness :) , do you have a script or some automation for this ?

Charlie


"Ben Hinkle" <ben.hinkle gmail.com> wrote in message
news:d2jie3$nl1$1 digitaldaemon.com...
 I started a few project that needed the dmd front end code so I got the
 source for the DMD front-end into a standalone form and have put it on my
 website as a "starter kit" for others to build D parsers and analyzers.

 it at
 http://home.comcast.net/~benhinkle/dmdfe
 There is a pre-built program that just prints debugging parsing and

 information but that program by itself is not very useful. Hopefully it

 be easy for people to customize for different tools but if there's

 I can do to improve the starter kit let me know.

 Currently only Windows is supported (but that's probably just becuase I
 haven't made a Makefile for Linux yet). The project is GPL.

 Happy Tooling!

 -Ben

Apr 01 2005
parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Charlie" <charles jwavro.com> wrote in message 
news:d2jsas$12eo$1 digitaldaemon.com...
 Coolness :) , do you have a script or some automation for this ?

no but it's a good idea. I emailed Walter some changes to get the #includes working so that I didn't have to worry about including total.h or something. Other than that I uncommented some printf's to get some debugging output and the rest is right out of the dmd.zip. Hopefully with new versions of dmd it shouldn't be much work to plop it in.
Apr 01 2005
parent reply "Charlie" <charles jwavro.com> writes:
 Hopefully with new versions of dmd it
 shouldn't be much work to plop it in.

Yea it will help alot I think. Thanks for doing this! Charlie "Ben Hinkle" <bhinkle mathworks.com> wrote in message news:d2jue1$146c$1 digitaldaemon.com...
 "Charlie" <charles jwavro.com> wrote in message
 news:d2jsas$12eo$1 digitaldaemon.com...
 Coolness :) , do you have a script or some automation for this ?

no but it's a good idea. I emailed Walter some changes to get the

 working so that I didn't have to worry about including total.h or

 Other than that I uncommented some printf's to get some debugging output

 the rest is right out of the dmd.zip. Hopefully with new versions of dmd

 shouldn't be much work to plop it in.

Apr 01 2005
parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Charlie" <charles jwavro.com> wrote in message 
news:d2k1bk$1798$1 digitaldaemon.com...
 Hopefully with new versions of dmd it
 shouldn't be much work to plop it in.

Yea it will help alot I think. Thanks for doing this!

no problem. I'm working on getting a basic dlint going and hooking it up to the emacs mode for error and warning highlighting. That and I want to write a reflection API generator. It's also fun to see just how much of phobos gets sucked in when you import std.string :-)
Apr 01 2005
parent reply "Charlie" <charles jwavro.com> writes:
 I'm working on getting a basic dlint going and hooking it up to
 the emacs mode for error and warning highlighting

Coolness.
 That and I want to write
 a reflection API generator.

Now this sounds fun :). Have you started getting some ideas down on it ? I'd like to hear 'em ( are you going to add meta-data to the executable ? If so where you going to put it so D doesnt require a new exe format ? ) C "Ben Hinkle" <bhinkle mathworks.com> wrote in message news:d2k6r0$1cpr$1 digitaldaemon.com...
 "Charlie" <charles jwavro.com> wrote in message
 news:d2k1bk$1798$1 digitaldaemon.com...
 Hopefully with new versions of dmd it
 shouldn't be much work to plop it in.

Yea it will help alot I think. Thanks for doing this!

no problem. I'm working on getting a basic dlint going and hooking it up

 the emacs mode for error and warning highlighting. That and I want to

 a reflection API generator.
 It's also fun to see just how much of phobos gets sucked in when you

 std.string :-)

Apr 01 2005
next sibling parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Charlie" <charles jwavro.com> wrote in message 
news:d2kbrj$1hu4$1 digitaldaemon.com...
 I'm working on getting a basic dlint going and hooking it up to
 the emacs mode for error and warning highlighting

Coolness.
 That and I want to write
 a reflection API generator.

Now this sounds fun :). Have you started getting some ideas down on it ? I'd like to hear 'em ( are you going to add meta-data to the executable ? If so where you going to put it so D doesnt require a new exe format ? )

I was going to read in class source and write out D code for class(es) that implement a reflection API that resembles Java's reflection API. In other words if the input source code looks like class Foo { int x; void bar() {} } then the output class looks something like class FooClass : Class { this() { fields ~= new Field("x",typeid(int),Access.Public); methods ~= new Method("bar",<signature>, Access.Public); } Object newInstance(){ return new Foo(); } ... } static this() { registerClass("Foo",...); } You have to compile the reflection class and link it in with any class that you want reflected. I haven't thought about how exactly the registration happens or all the signature stuff will work etc etc but I figure something along these lines should work out. The front end should have all the info about members and constructors that one would need.
Apr 01 2005
parent reply "Charlie" <charles jwavro.com> writes:
 I was going to read in class source and write out D code for class(es)

 implement a reflection API that resembles Java's reflection API. In other
 words if the input source code looks like

Ahh cool didnt know Java did it like this. Attached is a simple php script to convert the front-end to be compilable by MSVC. It doesnt catch everything ( sys/time.h ) but it should catch most things. Charlie "Ben Hinkle" <bhinkle mathworks.com> wrote in message news:d2kd45$1j2b$1 digitaldaemon.com...
 "Charlie" <charles jwavro.com> wrote in message
 news:d2kbrj$1hu4$1 digitaldaemon.com...
 I'm working on getting a basic dlint going and hooking it up to
 the emacs mode for error and warning highlighting

Coolness.
 That and I want to write
 a reflection API generator.

Now this sounds fun :). Have you started getting some ideas down on it


 I'd like to hear 'em ( are you going to add meta-data to the executable


 If so where you going to put it so D doesnt require a new exe format ? )

I was going to read in class source and write out D code for class(es)

 implement a reflection API that resembles Java's reflection API. In other
 words if the input source code looks like

   class Foo {
     int x;
     void bar() {}
   }

 then the output class looks something like

   class FooClass : Class {
     this() {
       fields ~= new Field("x",typeid(int),Access.Public);
       methods ~= new Method("bar",<signature>, Access.Public);
     }
     Object newInstance(){ return new Foo(); }
     ...
   }
   static this() { registerClass("Foo",...); }

 You have to compile the reflection class and link it in with any class

 you want reflected. I haven't thought about how exactly the registration
 happens or all the signature stuff will work etc etc but I figure

 along these lines should work out. The front end should have all the info
 about members and constructors that one would need.

Apr 01 2005
parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Charlie" <charles jwavro.com> wrote in message 
news:d2kj5p$1on1$1 digitaldaemon.com...
 I was going to read in class source and write out D code for class(es)

 implement a reflection API that resembles Java's reflection API. In other
 words if the input source code looks like

Ahh cool didnt know Java did it like this.

For more info about the Java API for the curious check out http://java.sun.com/j2se/1.5.0/docs/guide/reflection/spec/java-reflection.doc.html#8589 Basically you query the JVM for Class, Field, Method and Constructor objects and can apply them to instances or use them to construct instances. Since D doesn't have a JVM the only thing that knows the class layout is the compiler and so I think the best way to do reflection is to feed more code through the same compiler.
 Attached is a simple php script to convert the front-end to be compilable 
 by
 MSVC.  It doesnt catch everything ( sys/time.h ) but it should catch most
 things.

nifty. I'll stick it in the zip file if you don't object.
Apr 01 2005
prev sibling parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Charlie" <charles jwavro.com> wrote in message 
news:d2kbrj$1hu4$1 digitaldaemon.com...
 I'm working on getting a basic dlint going and hooking it up to
 the emacs mode for error and warning highlighting

Coolness.

Attached is a sneak-peak at dlint minor-mode in emacs (using the D major-mode). There are two warnings in the code- one about a function that should return a value that doesn't and another about a narrowing cast. I'll clean things up over the weekend and make another post when dlint (and the d-mode update) is ready. Thanks to Walter for the wonderful front-end code and warning implementation. -Ben ps -notice the cute little Dlint menu, too. It basically came for free from the mlint highlighter I'm using (written by my buddy Eric Ludlam - Emacs hacker extraordinaire) :-)
Apr 01 2005
next sibling parent "Charlie" <charles jwavro.com> writes:
Umm ... amazing!  I didn't even know they had a lint mode, how cool!


nifty. I'll stick it in the zip file if you don't object.

No not at all "Ben Hinkle" <ben.hinkle gmail.com> wrote in message news:d2kuks$22a8$1 digitaldaemon.com...
 "Charlie" <charles jwavro.com> wrote in message
 news:d2kbrj$1hu4$1 digitaldaemon.com...
 I'm working on getting a basic dlint going and hooking it up to
 the emacs mode for error and warning highlighting

Coolness.

Attached is a sneak-peak at dlint minor-mode in emacs (using the D major-mode). There are two warnings in the code- one about a function that should return a value that doesn't and another about a narrowing cast. I'll clean things up over the weekend and make another post when dlint

 the d-mode update) is ready. Thanks to Walter for the wonderful front-end
 code and warning implementation.

 -Ben

 ps -notice the cute little Dlint menu, too. It basically came for free

 the mlint highlighter I'm using (written by my buddy Eric Ludlam - Emacs
 hacker extraordinaire) :-)

Apr 02 2005
prev sibling parent reply "Charlie" <charles jwavro.com> writes:
Do you mind if I use this for elephant ?

C

"Ben Hinkle" <ben.hinkle gmail.com> wrote in message
news:d2kuks$22a8$1 digitaldaemon.com...
 "Charlie" <charles jwavro.com> wrote in message
 news:d2kbrj$1hu4$1 digitaldaemon.com...
 I'm working on getting a basic dlint going and hooking it up to
 the emacs mode for error and warning highlighting

Coolness.

Attached is a sneak-peak at dlint minor-mode in emacs (using the D major-mode). There are two warnings in the code- one about a function that should return a value that doesn't and another about a narrowing cast. I'll clean things up over the weekend and make another post when dlint

 the d-mode update) is ready. Thanks to Walter for the wonderful front-end
 code and warning implementation.

 -Ben

 ps -notice the cute little Dlint menu, too. It basically came for free

 the mlint highlighter I'm using (written by my buddy Eric Ludlam - Emacs
 hacker extraordinaire) :-)

Apr 03 2005
parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Charlie" <charles jwavro.com> wrote in message 
news:d2pn5u$8i9$1 digitaldaemon.com...
 Do you mind if I use this for elephant ?

 C

Please do. That's what it's there for. I'll post a real announcement now that I put it up.
Apr 03 2005
prev sibling parent reply "Lynn Allan" <l_d_allan adelphia.net> writes:
 Currently only Windows is supported (but that's probably just

 haven't made a Makefile for Linux yet). The project is GPL.

Just curious why you are using gpl ... was that necessary based on derivation, or your preference? If preference, why?
Apr 01 2005
parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Lynn Allan" <l_d_allan adelphia.net> wrote in message 
news:d2k3fj$19b0$1 digitaldaemon.com...
 Currently only Windows is supported (but that's probably just

 haven't made a Makefile for Linux yet). The project is GPL.

Just curious why you are using gpl ... was that necessary based on derivation, or your preference? If preference, why?

The dmd source allows either GPL or the artistic license and I just chose GPL because I understand it. I haven't looked closely at the artistic one - would you prefer that license? I'm not really sure how it differs from GPL, to be honest. Maybe I should keep the same style as dmd and say "either GPL or Artistic". That would probably be the best approach.
Apr 01 2005
next sibling parent "Walter" <newshound digitalmars.com> writes:
"Ben Hinkle" <bhinkle mathworks.com> wrote in message
news:d2k6ff$1cca$1 digitaldaemon.com...
 "Lynn Allan" <l_d_allan adelphia.net> wrote in message
 news:d2k3fj$19b0$1 digitaldaemon.com...
 Currently only Windows is supported (but that's probably just

 haven't made a Makefile for Linux yet). The project is GPL.

Just curious why you are using gpl ... was that necessary based on derivation, or your preference? If preference, why?

The dmd source allows either GPL or the artistic license and I just chose GPL because I understand it. I haven't looked closely at the artistic

 would you prefer that license? I'm not really sure how it differs from

 to be honest. Maybe I should keep the same style as dmd and say "either

 or Artistic". That would probably be the best approach.

The artistic license applies if you want to make a close source version.
Apr 02 2005
prev sibling parent reply "Lynn Allan" <l_d_allan adelphia.net> writes:
"Ben Hinkle" <bhinkle mathworks.com> wrote in message
news:d2k6ff$1cca$1 digitaldaemon.com...
 "Lynn Allan" <l_d_allan adelphia.net> wrote in message
 news:d2k3fj$19b0$1 digitaldaemon.com...
 Currently only Windows is supported (but that's probably just

 haven't made a Makefile for Linux yet). The project is GPL.

Just curious why you are using gpl ... was that necessary based on derivation, or your preference? If preference, why?

The dmd source allows either GPL or the artistic license and I just

 GPL because I understand it. I haven't looked closely at the

 would you prefer that license? I'm not really sure how it differs

 to be honest. Maybe I should keep the same style as dmd and say

 or Artistic". That would probably be the best approach.

<alert comment="IANAL"> And I'm also not a fan of gpl. From a developer's point of view, I've only seen downsides to using gpl compared to other common open source licenses (mpl, Artistic, LGPL, etc.), and no upside. Whenever I see a project with gpl, I just groan. "Crud, another library / tool that will be harder to work with than it has to be." I would come close to recommending public domain over gpl, but Artistic seems like quite a good choice. I remember trying to sort out the different license choices some time back, and Artistic was the choice I was going to use. A possible problem with Artistic is that I recall some time back, SourceForge didn't have "Artistic" as one of the options in the drop-down menu for which license you wanted to select. Or maybe it was some variant of "Modified Artistic"? It may very well have been added since then, so this is moot. </alert>
Apr 04 2005
parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
 Whenever I see a project with gpl, I just groan. "Crud, another
 library / tool that will be harder to work with than it has to be." I
 would come close to recommending public domain over gpl, but Artistic
 seems like quite a good choice. I remember trying to sort out the
 different license choices some time back, and Artistic was the choice
 I was going to use.

It's funny you say that because I totally agree. Most of my stuff is public domain.
Apr 04 2005