Idea: Run Time Compilation

BCS BCS at pathlink.com
Fri Mar 9 09:20:31 PST 2007


Frits van Bommel wrote:
> Johan Granberg wrote:
> 
>> Craig Black wrote:
>>
>>>
>>> What if we could invoke the compiler from an application at run time and
>>> generate a function that would be instantiated on the heap?  The 
>>> function
>>> would be defined by a text string and would be invoked via a function
>>> pointer or delegate.
> 
> 
> I've actually been doing something very similar to this already, but I 
> just write some source code to a file, compile it to a shared library, 
> and load it :P.

Darn you all! I've been thinking of both of these ideas for some time. 
<G> I like both ideas by the way.

However I wouldn't use text, I'd go with generated AST or something like 
that, maybe a mesh of basic blocks. I don't known exactly what, but it 
seems that the nature of memory being lots different than a text file 
would allow for some more fun (powerful) ways of doing things.



More information about the Digitalmars-d mailing list