[perl #39715] [TODO] IMCC errors should throw Parrot exceptions
Applied as r13307. Still needs some tweaking, e.g. fix the failing past.t, but good enough for now. leo
Re: [perl #39715] [TODO] #39715 IMCC errors should throw Parrot exceptions
On Wednesday 12 July 2006 22:02, Vishal Soni via RT wrote: This patch also introduces a Parrot API for the calling programs to compile the code. Currently pugs uses immc_compile() call into IMCC. Ideally Pugs should not be communicating with IMCC but with Parrot. This new API will try to hide IMCC/PASM compile details from programming languages PARROT_API PMC *Parrot_compile_string(Parrot_Interp interpreter, STRING *type, char *code, STRING **error); PARROT_API void *Parrot_compile_file(Parrot_Interp interpreter,char *fullname, String **error); I like this interface, except for the return value from Parrot_compile_file. Are there other options, such as returning a Sub PMC? -- c
Re: [perl #39715] [TODO] #39715 IMCC errors should throw Parrot exceptions
PARROT_API void *Parrot_compile_file(Parrot_Interp interpreter,char *fullname, String **error); I like this interface, except for the return value from Parrot_compile_file. Are there other options, such as returning a Sub PMC? Chip and I have had a chat about other possible API's which could be added in future. Some e.g. 1. To throw Parrot exceptions instead of the String **error. 2. Possibly using Compiler PMC. (not sure on that yet) Your suggestion is good and I will keep in mind. These two functions are just a start for defining Compile API's. Programming languages should not talk directly to IMCC or any other low level compiler like IMCC and PASM. Thanks for your suggestion. Vishal
Parrot Exceptions
Hi, I would like to throw a Parrot Exception from IMCC to the calling program instead of terminating IMCC when a parse error occurs. Are there some example in Parrot as to how to throw a Parrot exception and how to catch it? -Vishal
[perl #39715] [TODO] IMCC errors should throw Parrot exceptions
# New Ticket Created by Audrey Tang # Please include the string: [perl #39715] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=39715 Currently, if you use IMCC inside embedded parrot (eg. when compiling via PGE), when a syntax error occurs, imcc calls Parrot_exit (or downright exit() -- see imclexer.c)), and it terminates the interpreter right there without any chance of recover. It should throw an exception using the standard Parrot exception mechanism. Note that doing this may depend on removing the global states, as to make IMCC reentrant. PGP.sig Description: PGP signature
Re: Catching Parrot Exceptions
Pete Lomax [EMAIL PROTECTED] wrote: Null PMC access in set_integer_native() This (and a lot of others) currently doesn't throw a real_exception, so you can't catch it. P0 = _eh() That calls the exception handler directly as a sub. PS getline always returns 0, and getfile (unknown file), though I suspect people are aware of that. Run the code with -w. leo
Catching Parrot Exceptions
Hi, Just fishing for comments.. I have been experimenting with error handling, using P9 = 1 to force the error: Null PMC access in set_integer_native() (others too, such as Key not an integer! or Array index out of bounds!). I have found that: newsub P0, .Exception_Handler, _eh set_eh P0 ... _eh: does not catch it, whereas P0 = _eh() set_eh P0 ... _eh: does, however when _eh is called, P5 is just {0,}. I'd like to print/know whatever error it was I trapped. Pete PS getline always returns 0, and getfile (unknown file), though I suspect people are aware of that.