Jeroen Demeyer on Thu, 18 Sep 2008 12:12:50 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

GP and syntax errors


Hello list,

This is an issue which I already raised on the pari-users list, but I repeat it here in a longer way...

I don't like the fact that syntax errors cannot be trap()ped anymore with GP's new parser. I can certainly agree with the explanation in COMPAT that syntax errors and runtime-errors are completely different. But now GP basically ignores syntax errors (apart from printing an error message).

I have a few automatic GP scripts, i.e. scripts which run without user interface (like shell scripts). For those scripts, it is very annoying that there is no easy way to check for syntax errors.

I would like to have some way of detecting (not even handling) syntax errors more easily. I would be happy with any of the following: a) add syntax errors back into trap(). You could even make it such that you have to explicitly specify trap(syntax, ...) and that "syntax" would not be trapped by default. b) add a new command syntax_trap() which would behave like trap() for syntax errors. c) have a default along the lines of quit_gp_on_error which would exit gp with a non-zero exit status whenever an untrapped (syntax) error is encountered.

I don't know how easy it is to implement either a) or b), but c) should certainly be easy.


Cheers,
Jeroen.