If you are interested in the internals of how Sbasic works, you may be interested to read a blog entry from Marcel Kilgus where he describes in detail how he solved the “LRESPR in a procedure” bug which has existed for years in SBASIC.
It is not easy reading, even Marcel says it takes him huge efforts to barely understand parts of it.
Read his exploits at https://www.kilgus.net/2017/04/10/sbasic-bug-boogie/