To Walter: Question regarding the frontend code.

Tomas Lindquist Olsen tomas at famolsen.dk
Sat Jan 26 11:11:32 PST 2008


Hi Walter.

I tried to mail this, but I'm not sure the address was right, so I'll just post here...
Sorry if you already received the mail. Content below is the same.

I'm working on a LLVM based compiler for D based on your DMD frontend
version 1.026. You might have heard of it, it's the dsource project
LLVMDC.

Things are actually going fairly smoothly. I'm working on getting
Tango up and running, but I've hit an issue that I can't figure out.

The problem is with template instantiations I think. I'm not sure if
you have tango available, but the issue appears when I try to compile
"tango/io/Stdout.d".

This module includes several other modules, one being
"tango/text/convert/Layout.d" which has a template class inside it.

The problem I have appears when I try to generate code for the member
function: "tango.text.convert.Layout.Layout!(char).Layout.unknown",
which looks like this:

protected T[] unknown (T[] result, T[] format, TypeInfo type, Arg p)
        {
                return "{unhandled argument type: " ~ fromUtf8 (type.toString, result) ~ "}";
        }

In the AST the CatExp in the return statement has a NULL type. I've
tried out a few things, and just this:

protected T[] unknown (T[] result, T[] format, TypeInfo type, Arg p)
        {
                T x;
                return null;
        }

Will bork out as the type of the DeclarationExp is also NULL. (ie the
Expression::type member is null).
I'm guessing that somewhere some semantics are not being run as they
should, but I have no clue as to where this should be done.

I'm still just scratching the surface regarding the frontend, but I've
still managed to get a lot of code to compile (and work too). I'm
hoping you can help me overcome this problem so I can move on to more
interesting things.

Please let me know if you need more information, or just anything at
all :) I'd rather have a "don't have time" reply than none.

Many thanks in advance,
Tomas Lindquist Olsen

P.S. the problem is reproducible with the svn trunk version of the
code in the dsource repository.



More information about the Digitalmars-d mailing list