Im trying to parse a file using Bison/Yacc but i want to pause the parsing for a while. The reason i want to do this is that i want to process a huge file sequentially and simulate a java iterator using hasNext() and next() methods.
A trivial example would be, splitting a file by line using yacc so i could call:
while(myYaccObj.hasNext())
{
std::string line = myYaccObj.next()
}
I cant find how to "pause" the file scanning. Is there a way to do that?
yylex
whenever it needs to. And a common Bison usage is to callyyparse
once to generate one big AST. I think Tlol wants to know how to parse a file incrementally instead of in a singleyyparse
call. – Rob Kennedy