[RPL/2] self compiling ?

DEMAINE Benoit-Pierre benoit at demaine.info
Sam 17 Nov 03:04:30 CET 2007


Adrian Blake wrote:
> What I would like is an example of how it is done.

Bertrand asked you what you want.

And, you should email me; you should email the list. Otherwise, the
replyto get shuffled.

> 
> It is easy to create a text file of source code and then issue some
> system commands to compile and execute. If this is to be done many times
> most of the time and resources is spent with system commands and
> compiling. This is especially true if the programs are small and there
> are many to be recompiled many times.
> 
> Can RPL/2 do this in a simple manner?

Which langage do you use as generator ?
what do you want to generate ?
from where ?

what I did on HP48 was ... the only thing that is possible on this
machine: use RPL to generate RPL.

But, on a PC, you can go way further, like, use Perl to generate RPL,
test it as RPL, then ask the interpreter to generate C code for it, and
them querry GCC to optimise the code ...

RPL/2 can generate C from RPL, or directly produce a system executable
file (that is likely to be linked with some RPL library)

> 
> There is a programming language called Erlang which allows the
> programmer to modify and add to the executing code. The allows
> continuous upgrades without stopping the program.

RPL as conveived by HP was not designed to allow "on the fly self
modifiable code". And I dont think PC implementation by Bertrand
improoves this aspect in any maner.

Stil, from within RPL, a program can generate other programs, call them,
stop itself ... Bertrand also implemented some labels that will allow
special jumps: put a condition at the beginning, and perform
conditionnaly a GOTO thing. Still, you will have stack problems.

But, maybe Bertrand introduced some features that would allow some kind
of workaround ... if you have used assembly on micro architectures, and
if Bertrand did some kind of program counter/pointer, then, you may have
lot of fun around it :)

Note that there is not any up-to-date documentation. Do not rely on the
PDF generated. Rely on contextual help, and read the source.

***

for installation, there are 2 Gentoo ebuilds, and also a Debian package
somewhere. I wrote an ebuild, and someone else hold one in an overlay.

-- 
 >o_/ DEMAINE Benoit-Pierre (aka DoubleHP) http://benoit.demaine.info/
If computing were an exact science, IT engineers would not have work \_o<

"So all that's left, Is the proof that love's not only blind but deaf."
(FAKE TALES OF SAN FRANCISCO, Arctic Monkeys)


Plus d'informations sur la liste de diffusion RPL2