Benjamin Goldberg <[EMAIL PROTECTED]> writes: > Luke Palmer wrote: > > > > I started working on some XS code for embedding a Parrot interpreter in > > Perl. I ran into a few problems: > > > > 1) I don't know XS :-) (good way to learn, though) > > > > 2) What do I put as stacktop in Parrot_init()? I can't just use a > > local variable in the calling function, because it will return and > > there might be something lower than that later... > > If our DoD is no longer walking the C stack, then stacktop should no > longer be needed. Until the code is changed, just pass NULL.
AFAIK, the stack is still walked. (I don't like this but thats a diffrent story). So Parrot_init() should be called with a real stacktop. A typical codefragment to do this is: struct Parrot_Interp *interpreter; interpreter = Parrot_new(); Parrot_init(interpreter, &interpreter); > > 3) I'd like to have the PIR compiler available to this embedded > > interpreter. What would be the best way to do that? IMCC implements the (static) functions imcc_compile_pir and imcc_compile_pasm in parser_util.c. You can take a look at them. But be careful imcc uses some global data in the parser and the lexer, so this is not reentrant. bye boe -- Juergen Boemmels [EMAIL PROTECTED] Fachbereich Physik Tel: ++49-(0)631-205-2817 Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906 PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F 23 F6 C7 2F 85 93 DD 47