riff
riff copied to clipboard
Add proper error handling/unwinding
The interpreter currently prints some message to stderr
and immediately exits whenever a given error is encountered. There needs to be a more robust system in place s.t. various callers can properly unwind.
This will be a little tricky wrt the VM, especially builtin functions. I'd rather not have the VM check the return status every time a C function is called. It probably makes more sense to pass the global riff_state
struct around (similar to Lua). That way errors can continue to be directly thrown from anywhere in the interpreter, and some dedicated error handler (state.c
?) can do any necessary unwinding.