Closed bauersimon closed 10 months ago
Yes better error messages are probably one of the most important features right now. Thanks also for your thoughts on this, I already did some work in this direction using something like an AstNode and hope to be able to release that soon.
Since you're working on this, I also noticed that the error message when trying to load a waveform from a non-existent file the message is quite unfortunate:
(load "bar.fst" <foo>)
cannot access local variable 'signals' where it is not associated with a value
Closing, since this is now finally implemented.
It can be challenging to figure out where a runtime error is coming from (especially for non-trivial
wal
scripts). Usually, the name of the problematic operation is supplied with the error message. However, it can still take quite a while to pin-point what's wrong.I already investigated a bit how this could be done. In the
reader.py
callingLark(propagate_positions=True)
adds position information to the parse tree. The question is how to continue from there once the tree is transformed intowal
internal structures.I guess it would be enough to somehow attach line information to operators for the beginning, as those are very likely responsible for runtime errors. The question remains how to achieve this? Maybe introducing a wrapper
AstNode
that can hold the position information or a separate map that connects operations (essentially the[Operator, args...]
sincepython
lists are references) to line numbers. Maybe theSEval.eval
would be a good location to catch any arising exceptions and attach the problematic line number to them.