Yodel! On Friday 13 March 2009 10:28:08 Giacomo A. Catenazzi wrote: > Adam Borowski wrote: > > On Wed, Mar 11, 2009 at 11:21:08PM +0100, Stefano Zacchiroli wrote: > >> A C source file by itself cannot be run > >> without having been compiled > > > > I guess you haven't seen the Real Men's only true scripting language. > > > > apt-get install tcc ... > It is not real C ;-) > > few assumptions on compiled language doesn't allow you to > interpret a compiled language (and usually also the contrary). > Few programs use such assumptions, but anyway... While I agree that modern (dynamically typed etc.) scripting languages cannot easily be compiled (note that this is only a practical difference, not a theoretical one), I fail to see the difficulty with executing C from an interpreter. In fact C makes quite few assumptions about the runtime environment and doesn't expect much/any behind the scenes magic to happen. I bet a C interpreter could even be written so that it only uses memory when the C source also would allocate memory (entering a stack frame and malloc) [1], so while the interpreted program would probably hit OOM earlier then the compiled one, it would still do so only at the same places that a compiled program might hit OOM. [1] One obvious way is to parse a whole function on entering it. Given the low complexity of plain C code, it can then be executed without allocating further memory by just jumping around in the parse tree. cheers -- vbi -- featured product: Debian GNU/Linux - http://debian.org
Attachment:
signature.asc
Description: This is a digitally signed message part.