In keykit, there are two areas where multiple arrays are used to track data in lockstep - instruction segments (Iseg, Lastin, Future) and nested source context (Fin, Infile, Lineno, Autopop). Replace all those arrays with two arrays of structures, InstSegment that holds Iseg, Lastin, Future, and SourceContext that holds Fin, Infile Lineo and Autopop.
When execerror is called, need to "unwind" SourceContext back to what was in effect when execstack was called - add popscontextuntil(level) that pops source context until the saved level matchs the current level - allowing following calls to pushfin to succeed.
In keykit, there are two areas where multiple arrays are used to track data in lockstep - instruction segments (Iseg, Lastin, Future) and nested source context (Fin, Infile, Lineno, Autopop). Replace all those arrays with two arrays of structures, InstSegment that holds Iseg, Lastin, Future, and SourceContext that holds Fin, Infile Lineo and Autopop. When execerror is called, need to "unwind" SourceContext back to what was in effect when execstack was called - add popscontextuntil(level) that pops source context until the saved level matchs the current level - allowing following calls to pushfin to succeed.