dnet - a D compiler to target the CLR (.Net / Mono)

Tim Matthews tim.matthews7 at gmail.com
Sun Dec 20 13:02:40 PST 2009


dnet. D frontend (dmd 2.036). CLR backend.

It is in a very alpha like state and this is just a callout for 
developers to work on this compiler. Not for anyone intending to 
immediately target the CLR with D.

Cristi Vlasceanu wrote most of the backend code but he was always 
finding increasingly less time to work on it with new employment 
opportunities. I have been trying to keep this project alive but I may 
not be able to give full commitment either.

C++ developers wanted. Maybe other roles too.

A few things are working, for example a Quine:

module io;

import System;
import System.IO;

void main()
{
     String s = File.ReadAllText("./io.d".sys);
     Console.WriteLine(s);
}


compiling this with "dnet io.d" produces io.il:

//--------------------------------------------------------------
// io.d compiled: Mon Dec 21 09:58:42 2009
//--------------------------------------------------------------
.assembly extern 'System'
{
   .publickeytoken = (b7 7a 5c 56 19 34 e0 89 )
   .ver 2:0:0:0
}
.assembly extern 'System.Configuration'
{
   .publickeytoken = (b0 3f 5f 7f 11 d5 0a 3a )
   .ver 2:0:0:0
}
.assembly extern 'System.Drawing'
{
   .publickeytoken = (b0 3f 5f 7f 11 d5 0a 3a )
   .ver 2:0:0:0
}
.assembly extern 'System.Security'
{
   .publickeytoken = (b0 3f 5f 7f 11 d5 0a 3a )
   .ver 2:0:0:0
}
.assembly extern 'System.Windows.Forms'
{
   .publickeytoken = (b7 7a 5c 56 19 34 e0 89 )
   .ver 2:0:0:0
}
.assembly extern 'System.Xml'
{
   .publickeytoken = (b7 7a 5c 56 19 34 e0 89 )
   .ver 2:0:0:0
}
.assembly extern 'mscorlib'
{
   .publickeytoken = (b7 7a 5c 56 19 34 e0 89 )
   .ver 2:0:0:0
}
.assembly extern dnetlib {}
.assembly 'io' {}
.module 'io'

//--------------------------------------------------------------
// main program
//--------------------------------------------------------------
.method public hidebysig static void '_Dmain' ()
{
   .entrypoint
   .maxstack 2
   .locals init (
     [0] string 's' /* refcount=2 */
   )
   call class [mscorlib]System.Text.Encoding 
[mscorlib]System.Text.Encoding::get_UTF8()
   ldstr "./io.d"
   callvirt instance uint8[] 
[mscorlib]System.Text.Encoding::GetBytes(string)
   call string [dnetlib]runtime.dnet::'sys' (unsigned int8 [])
   call string [mscorlib]System.IO.File::'ReadAllText' (string)
   stloc.s 0	// 's' (string)
   ldloc.0	// 's' (string)
   call void [mscorlib]System.Console::'WriteLine' (string)
   ret
}


the dnet compiler then automatically calls ilasm on this file to produce 
io.exe.



More information about the Digitalmars-d-announce mailing list