lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


David Given wrote:

On Wednesday 22 February 2006 12:39, Lisa Parratt wrote:
[...]
Actually, my current cheat (because I can't be bothered to do what
you've described yet ;) is to use the same syntax tree to compute all
the primitive types of function dispatch, spit it out in a C file,
compile it into a (dynamic) library, and then use that to dispatch the
calls. Wonderfully portable, an acceptable level of hackiness - the only
real downsides with it is it need preprocessing (but then so do the data
structures from the syntax tree), and that it can't support varargs.

Eeee! Acck! That's horrific! OTOH, as you say, it works... what compiler do you use? Do you run into problems that invoking the compiler takes an unacceptable amount of time? (In which case, tcc would probably really help you, particularly as you can use it as a code generation library...)

One person in our labs has work on this kind of method : generating on the fly c++ code, compile in background and reload dynamically the build library. The c++ code wasn't generated from Lua but it doesn't matter. The idea is the same and "seems" to be interresting, but I think time compiling and loading with this solution is a critical because even if it seems to work it can take a lot of time (millisecond upto few seconds) to do this. So I am interresting to see the result with such an approach...

Oh, yes, for the record: Fabrice Bellard is scarily smart. Have you seen his other projects?

begin:vcard
fn:David HERVIOU
n:HERVIOU;David
org;quoted-printable:Ecole Nationale d'Ing=C3=A9nieurs de Brest
adr;quoted-printable;dom:BP 38;;25, rue Claude Chappe;Plouzan=C3=A9;France;29280
email;internet:herviou@enib.fr
title;quoted-printable:Centre Europ=C3=A9en de R=C3=A9alit=C3=A9 Virtuelle
tel;work:+33 (0)2 98 05 89 45
tel;fax:+33 (0)2 98 05 89 79
note;quoted-printable:Doctorant En Informatique au laboratoire LISyC (Laboratoire d'Informatiqu=
	e des Syst=C3=A8mes Complexes) dans le cadre du projet AR=C3=A9Vi.
url:http://www.cerv.fr/~herviou
version:2.1
end:vcard