concurrent Pascal Parser/Compiler without semaphore in C++