0
votes

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.

1
off topic: i just did a search for picoc iteratively: .. google's already indexed my question.. ( not bad ! ). stackoverflow.com/questions/7583494/…user967007

1 Answers

0
votes

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.