interpreter: Add exception backtraces #3

Open Jookia opened this issue on 24 Aug 2021 - 0 comments

@Jookia Jookia commented on 24 Aug 2021

Currently when an error happens in the interpreter it gives a single message as an error.

It should provide a backtrace containing the following details:

  • The location (file, line, column) of each frame
  • Variables associated with the frame's scope

For instance, in this code block I 'mistakenly' append a boolean to a text:

NewLang 0
Set Prefix To BeginText Hello there EndText EndSet
Set Name To True EndSet
Set Greeting To Prefix Append Name EndSet
System Print Name Done
System Exit Done

This of course gives the error Interpreter error: Invalid argument type Bool, expected Text.

I don't know two vital pieces of information: Where it happened, or what values it happened with.

Ideally we would get some output like this:

Interpreter error: Invalid argument type Bool, expected Text
While running action: 'Prefix Append Name' in bad.txt on line 4, column 17
Prefix is Text: Hello there
Name is Boolean: True
@Jookia Jookia changed title from interpeter: Add exception backtraces to interpreter: Add exception backtraces on 24 Aug 2021
@Jookia Jookia added the interpreter label on 24 Aug 2021

No milestone
No one assigned
1 participant