作为迭代函数非递归运行 picoC
我一直在尝试一些 C 解释器并发现 picoC 看起来可以满足我所有的需求。
启动您调用的脚本 void PicocCallMain(int argc, char **argv);它递归地调用内部 解析器等。
是否可以重新编码 picoC,以便我可以迭代运行脚本。
例如。
while(1)
{
picoCyield(&script1);
picoCyield(&script2);
}
每次调用 picoCyield 都会调用令牌读取器,但不会超过所需的次数 执行尽可能小的脚本块。
我可以按原样使用线程运行 picoC,但我正在工作的环境 禁止它..
任何帮助,或指向可以执行此操作的类似解释器的指针,都会 不胜感激。
I've been playing around with a few C interpreters and have found
picoC to look like it meets all my needs.
to kick off a script you call
void PicocCallMain(int argc, char **argv); which recursively calls the internal
parser etc..
Is it possible to recode picoC so that I could run scripts iteratively.
for example.
while(1)
{
picoCyield(&script1);
picoCyield(&script2);
}
each call to picoCyield would call the token reader no more than required to
execute the smallest possible block of script.
I could run picoC as is with threads, but I the enviorment I am working in
prohibits it..
Any help, or pointers to a similair interpreter that can do this, would
be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会查看交互模式的顶级代码。当前打印提示并等待输入的地方,我将替换为程序的回调,您将使用该回调来提供下一条语句。那么所有的逐行执行都已经为您完成了。
I would look at the top-level code for interactive mode. Where it currently prints the prompt and waits for input, I would replace with a callback to your program which you would use to provide the next statement. Then all the line-by-line execution is already done for you.