I have received a number of inquiries about my old D.NET project with people wanting the source code or wondering when I will finish it. I have decided that it was time to put it all to rest and perhaps pass the torch, along with what knowledge I have acquired during the project in hopes that someone else will do it right.
First off, I no longer have the code. I lost it in a HDD crash, so please do not e-mail me for it anymore.
Secondly, I wouldn't give it even if I had it, because it so badly mangled the D front-end, and was so poorly designed in general, that I could not advocate its use, even for a learning tool.
I will, however, point anyone interested in the general direction for how to use NET's Compiler namespace to generate assemblies. This is far from a comprehensive analysis, but it should at least give you enough to get started. Much of the rest can be learned from the myriad MSDN articles available online.
The basic process for creating a .NET assembly is this: (If you can't follow this, then take a few programming classes or read some tutorials before you try this, because you'll have no hope otherwise)
- Instantiate the AssemblyBuilder class
- Use it to create new ModuleBuilder instances
- In each module, you can use the various other *Builder classes to create the framework for the module (VariableBuilder, FunctionBuilder, ClassBuilder, etc)
The biggest advice I have to offer is not to build it directly in the front-end, but rather implement the stubs in the front-end to build an input file that you can then pass to the assembly generator code.
I hope this helps. .NET is really too wonderful a concept for D to ignore, so I hope someone decides to take this up again.
Best of luck,
- Alternative url: http://www.scratch-ware.net/dfiles/
- Old Version: http://mywebspace.wisc.edu/daaugustine/web/d/
- D.NET requires Microsoft's VC++ 2005 Express Beta to be installed. (Apparently, D.NET is incompatible with the VC++ 2005 Beta 2. Unless you've previously downloaded the first Beta, you probably can't run the D.Net compiler.)
Below are some excerpts from posts related to a project by Deja Augustine to create a D compiler that produces MSIL.
I would simply like to add that if the code gods smile upon me, D will soon be able to interop with .NET while still maintaining it's current compatibility with C-linked binaries.
D.NET is turning out to be much closer to Managed D than D# which I think we can all agree is for the best.
To all of you out there waiting with bated breath for D.NET, you may now breathe a little easier knowing that the project is finally making some headway.
A few things to note:
- Since the .NET CLR supports global variables and functions, it's not necessary to wrap everything in classes ala C#
- The import statement has been modified so that if it doesn't find a D module, it looks for assemblies.
- The compiler automatically imports mscorlib, and all classes automatically derive from [mscorlib]System.Object
Since this project is progressing quickly, I've decided that the best way to show updated progress is to actually link to my test file.
I've put in a few comments in describing some of the things that may not be obvious, but most of it should be.
At the end of the file is the output generated by the program.
Here's the code test file that I'm using to test out D.NET. Someone was nice enough to point out that I can make it pretty using SciTE and thus I have done so.
D.NET is a D compiler that I'm writing (I'd call it a back-end, except that it's reaching the point where I'm almost forking the front-end because I've had to modify it so much).
D.NET compiles standard D code into MSIL which is the .NET intermediate language used to create .NET compatible assemblies. The assemblies generated by D.NET are usable in other .NET languages such as Managed C++, C#, VB.NET, ASP.NET, etc.
I've reached the point in D.NET where I'm playing around with calling native D code from .NET. I'm running into an interesting dilema, as I cannot figure out what D is expecting.
- From NG:digitalmars.D/8398:
- No problem, just use the extern (C) calling convention in your D code that you want to interface with .NET. No need for wrappers.
Since I'm currently moving and I'm not sure if I'll be able to have my webserver running in my new home, the Python/D and D.NET websites are in a state of flux.
I have set up a web forward to point to my temporary site for now and it will then forward to my new permanant site once I have one, but if you're looking for information about Python/D or D.NET, check out:
Currently all I have uploaded is an in-progress article I'm writing discussing the nuances of working with D.NET, but I plan to have a full-blown site up and running once I get moved and have my desktop computer set up again.
Until then, enjoy the work in progress that'll be updated frequently over the next few days
Actually, that link is relatively worthless at the moment, since my normal webserver (with all my files) is currently sitting unplugged beside me ready for when I move.
But, to answer your question, yes. I've already written most of a D.NET compiler. I'm refactoring it right now to make it easier to apply bug fixes to DMD directly to D.NET as they both use the same basic front-end code. Once that's completed, there are only a scant few more features I need to implement (inline IL, templates, foreach, etc.) before a beta is released.
Continue to monitor that link, however, as it will change to reflect my real D.NET site once I'm done moving next week.
Since I don't know how long it'll be before I have a proper beta up and running I've decided to release what I have so far with a very simple caveat:
"This software carries NO guarentees whatsoever, implied or explicit. Use at your own risk."
Check out http://dnet.scratch-ware.net/ for the download.
Thanks to the mild excitement displayed over the D.NET project, I've found my second wind on the project and the first thing I did was to overhaul the way arrays and slices are handled to put them in line with the D style of slicing.
I've uploaded a new version of D.NET that does proper slicing as well as a new version of my test file to show you what I've tested and what works for sure. They can be found (respectively) at:
Even though it's a relatively minor update, I thought it noteworthy to point out that D.NET's front-end source has been sync'd up to DMD 0.101.
I apologize for the long period of down-time on my server. As soon as the DNS updates, you should be able to access all of my D project files from:
(latest version is called D.NET Compiler v0.102.95 Alpha)
Deja, I was wondering if you could try to compile D.NET with Mono. -- CarlosSantander
... but D.NET is written in C++, right? In that case it wouldn't be possible. -- CarlosSantander