K Stol <[EMAIL PROTECTED]> wrote: > From: "Leopold Toetsch" <[EMAIL PROTECTED]> >> .pcc_sub _main prototyped # only one "_main" allowed like in C
> 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'. I think as C can live with that we can too ;-) > Also, (I just realize while typing this), how does IMCC decide where to > start executing? Is it just at the first sub it sees? Currently imcc doesn't do anything special: It just emits the code one compilation unit after the other. Execution starts at the first statement of the first unit. But with the constant Sub PMC in the packfile execution could start at "_main" then. > Another thought: (I assume "exit_ic" is a special op for exiting the > interpreter?) Its the internal notation of the C<exit> opcode taking an INT argument. > 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. Sure. An empty return block (one without the explicit ".return 0" directive would boil down to just C<end>. I'm not sure yet, if the interpreter itself should through a SystemExit exception. Its probably not necessary. Languages like Python that need it, can emit C<exit 0> to get the desired behavior. > Klaas-Jan leo