Interested in being abreast of the GSoC 2012 projects? Here's how

Jacob Carlborg doob at me.com
Wed May 23 12:51:45 PDT 2012


On 2012-05-23 19:11, Andrew Wiley wrote:

> Ultimately, it doesn't really change the number of steps required:
> (Foo -> Bar means a compiler that runs on Foo and outputs binaries that
> run on Bar)
>
> Standard cross compiler sequence:
> 1. Compile DC (Foo -> Bar) on Foo using the existing DC (Foo -> Foo)
> 2. Compile DC (Bar -> Bar) on Foo using the newly built DC (Foo -> Bar)
> Now you have Bar -> Bar, which is what you wanted, and we had to build
> DC twice. DC also has to support codegen for both Foo and Bar.
>
> What you seem to be wanting is this:
> 1. Compile DC ((C code) -> Bar) on Foo using the existing DC (Foo ->
> {Foo,C})
> 2. Use the C compiler on Bar to turn (C code) -> Bar into Bar -> Bar
> (but this build is slow because it used C as an intermediate form)
> 3. Use the slow Bar -> Bar to compile a fast Bar -> Bar
> Again, we have Bar -> Bar after two builds of DC, but DC had to support
> codegen for Foo, Bar, and C.
>
> Targeting C doesn't really seem to make bootstrapping like this any more
> efficient.

Then what's the problem.

> Unfortunately, I don't really have a satisfying solution to this. At the
> moment, we're reinventing the wheel. The best alternative I see if a
> library like this were to exist would be to port it instead of
> reinventing it. Maybe using it from a VM wouldn't be as hard as I'm
> thinking, but it's hard to speculate.

I might be less of a problem when the language isn't changed that much.

>     On the other hand if you have a compiler library you can build a
>     tool based on the library that translates D code to Java, C# or
>     perhaps their byte code equivalents. Then you can automatically
>     translate the compiler library to whatever language you like and
>     integrate it with VM-based IDE's.
>
>
> I agree with Roman that automated translation to a VM language would
> probably be a difficult thing to attempt, although I think it could be
> doable. I don't think the effort/benefit ration is low enough. It's not
> often that someone needs a mechanical translation of a D library to
> another language.

Perhaps a tool for automatically creating bindings to the compiler 
library. But then I don't know how efficient it would be to move the 
necessary data across the VM boundaries.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list