MOO-cows Mailing List Archive


Re: MOO into C

On Wed, 24 Jul 1996 wrote:

> It never is decompiled. The verb source is stored seperately from the
> byte-compiled version, in text form. Try disassembling some byte-compiled code
> one day and try decompiling it... it's just not possible (easily).
	When you call ;set_verb_code() or use .program, the text sent to
the server for compilation is compiled into a program and then discarded.
The MOO bytecode language is designed such that reverse compilation of the
bytecodes can (relatively) easily produce the original source.  This is
why C-style comments (/* Comment */) are not conserved and why if you
;;set_verb_code(me, "test", {"#0.player;"}); return verb_code(me, "test");
 You will find that you get this:
=> "$player;"
Likewise, null statements (consisting of only a semicolon) are discarded,
as are else branches of if statements containing no actual statements or
only null statements.  The compiler produces no bytecodes for these
degenerate instances, so the decompiler never knows they're there.
	This decompilability causes the problems listed above, in addition
to the fact that reverse compilation is *not* a quick or easy procedure.
It provides advantages, however, when finding line numbers to print in
tracebacks, and in saving space in the RAM image of the DB.  The only
place where verbs are stored as source is in the disk image of a DB, which
is produces by the decompilation of the verbs.  Finally, if no
decompilation takes place, there would not need to be a decompile.[c|h]
file in the distribution ;>

 --Nick Ingolia



Home | Subject Index | Thread Index