----- Original Message ----- From: "Leopold Toetsch" <[EMAIL PROTECTED]> To: "K Stol" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, August 31, 2003 4:52 AM Subject: Re: [CVS ci] exit opcode
> K Stol <[EMAIL PROTECTED]> wrote: > > > $I0 = 0 # > > .pcc_begin_return # > > .return $I0; # return 0; /* return to > > shell */ > > .pcc_end_return # } > > .end > > > Just an idea. > > Good one. So in "main" the return statement can translate to "exit_ic?" > then. How do we tell, what is "main"? Just the entry label is "_main:": > > .pcc_sub _main prototyped # only one "_main" allowed like in C > good point. Generally, I don't like exceptions or special cases in code, or implicit rules, but because most compilers will emit a "main" sub first, one could say this should be the ".pcc_sub _main prototyped" sub. This is not *that* ugly, just look at C, for example. Any C program should have a "main", so it's not that strange to have a special 'purpose sub'. Also, (I just realize while typing this), how does IMCC decide where to start executing? Is it just at the first sub it sees? Another thought: (I assume "exit_ic" is a special op for exiting the interpreter?) isn't it possible to *not* use an "exit_ic" op, but just do a "return"? I know a PASM file should end with "end", but somehow it would be nice to just do a "return", and this return op will return to the calling procedure, which happens to be the Parrot interpreter. Klaas-Jan