Compiler as dll

Benji Smith dlanguage at benjismith.net
Tue Jan 27 19:59:30 PST 2009


BCS wrote:
> Hello Walter,
> 
>>
>> Instead, what you can do is simply dude up command line arguments,
>> spawn the command line compiler, and collect the result.
>>
> 
> The one main thing I see not working there is memory-to-memory compiles. 
> I'd love to be able to build a function as a string, call the compiler 
> and get back a function pointer.

I think also, with a compiler-as-dll, it'd have separate modules for 
lexing, parsing, optimizing, code-generation, and linking.

As a user of that compiler DLL, I might like to write my own AST 
visitor, wrapping all function calls (or scope blocks) with tracing 
statements before sending them into the rest of the pipeline.

Those are the kinds of things that I think would be especially cool with 
a CompilerServices module in the standard library.

Also, consider this: someone could implement AST macros as a library!

--benji



More information about the Digitalmars-d mailing list