Code Mixins for Compiler Bootstrapping

Joel C. Salomon JoelCSalomon at Gmail.com
Wed Feb 14 07:28:16 PST 2007


Russell Lewis wrote:
> One of the original goals of D was to make it easy to write compilers 
> for it.  I love the new features, but I am concerned that they are 
> making the language so feature-rich that it will be very difficult to 
> write a complete and correct compiler.
> 
> This new "code mixin" feature, though, opens up a set of interesting 
> possibilities: what if we developed a standard library, which would 
> parse "standard D" (whatever that standard becomes in the future) and 
> generates "simple D" (which is some simple version of D, which anybody 
> could trivial write a compiler for).
> 
> That is, you could create a complete standards-compliant D compiler 
> simply by writing a D compiler which implemented:
> * Basic D structural features
> * Code mixins
> * The most basic of template handling (to parse the mixin)

I came aboard here because I’m taking a compiler theory class and had 
hopes of implementing D on a new platform (Plan 9; just incompatible 
enough with lunix to make porting GDC well-nigh impossible).  I quickly 
learned that D as defined today is /not/ a “my first compiler” language 
— more so in that it’s still a moving target.

Define this D-- and I’ll have a go at it.

--Joel



More information about the Digitalmars-d mailing list