Add line numbers to parser error messages #574
Labels
assembly
Related to Miden assembly
enhancement
New feature or request
good first issue
Good for newcomers
To improve debugging experience, it may be helpful to know which lines in the source file contain malformed instructions. This can be achieved by adding line numbers to the
ParsingError
messages.To do this, we need to add line number to the Token struct. This may be in addition to, or instead of, the current
pos
field. This also means that we should collect line number info when we construct a token stream (i.e., here).It would probably make sense to track line numbers is a separate map inside a
TokenStream
. This map would map a token position to a line number. This may result in a non-negligible performance overhead, and thus, we may want to introduce an option to instantiate token streams in debug mode. Then, line number info would be collected only in debug mode.Note: this would help only with errors generated by the parsers. For better run-time debugging experience a more comprehensive solution is needed.
The text was updated successfully, but these errors were encountered: