hscript
hscript copied to clipboard
Add steppable/interruptible interpreter
This pull is for a variation on Interp; IterativeInterp.
It makes it possible to step through hscript blocks of arbitrary complexity in discrete steps while maintaining variables and so on. There is theoretically no hscript expression that will cause this interpreter to hang.
Use cases include time sharing between multiple scripts, splitting a script over multiple frames, implementing script containing endless loops on single-threaded targets, and debugging scripts by stepping over each expression (nearly) one at a time.
See IterativeREADME.md for usage details.
This in general needs a pretty major code review, if anyone would be keen to give one. There are some cases already where it should fail (array instantiation is something I haven't looked into a great deal yet, for example). The majority of the effort was spent on EFunction/ECall.
~It also does not in any way support hscriptPos at this point. I need to get my head around how to work with ExprDefs.~
With the latest updates, this is now compatible with the hscriptPos flag. There are some situations, however, where PosInfo will become inaccurate at runtime for certain expressions.
What's the situation with this? I have a use for this kind of thing as I'm currently working around it in a kinda annoyingly hacky way by wrapping expression after they come out of parsing in my own "execution stack closure list" and running those one by one. An interpreter that could be halted/yielded from the outside, would fix this issue. :)
That's interesting, but I have not much time to review it atm.
Le mar. 5 mai 2020 à 13:32, muchitto [email protected] a écrit :
What's the situation with this? I have a use for this kind of thing as I'm currently working around it in a kinda annoyingly hacky way by wrapping expression after they come out of parsing in my own "execution stack closure list" and running those one by one. An interpreter that could be halted/yielded from the outside, would fix this issue. :)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/HaxeFoundation/hscript/pull/79#issuecomment-624000997, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQA5OERTD45AKTDMYUDRP72NLANCNFSM4HIASISA .
What's the situation with this? I have a use for this kind of thing as I'm currently working around it in a kinda annoyingly hacky way by wrapping expression after they come out of parsing in my own "execution stack closure list" and running those one by one. An interpreter that could be halted/yielded from the outside, would fix this issue. :)
I use it in production for https://talosfray.TV with no issues as far as I can tell, so using it from my fork is an option if you're desperate.
I would also have a use for this.