Easiest way to interrupt VM when specific predicate is the goal (syscall)? #2662
Replies: 2 comments 4 replies
-
Not sure if applicable, but that sounds a lot like If I understand this in another way (running code "outside of Scryer Prolog"), this also sounds a lot like |
Beta Was this translation helpful? Give feedback.
-
Can you be a little more specific about what you mean by "interrupt the VM's main loop"? This is an area I'm also researching for embedded C# video game stuff. As @triska mentioned, a meta interpreter is probably a key technique, and there are a few lower lever techniques such as |
Beta Was this translation helpful? Give feedback.
-
Hi all, here's a potentially odd question: what would be the easiest way for me to interrupt the VM's main loop when a specific predicate becomes the goal? What I want to do is basically implement the equivalent of syscalls for some imaginary platform.
When such a predicate is "called", the execution is interrupted and goes back to the host running the VM. The host solves the predicate and gives some substitutions back to the VM to resume execution from exactly that point with the answers given by the host.
I found that
machine::mod::try_execute
andmachine::system_calls::fast_calls
are good places to start, but maybe there's even a mechanism already for that kind of stuff internally so wanted to ask before I try to reinvent anything.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions