Parsec parser library...

"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]> Sat, 25 Jul 2026 14:51:23 -0700
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
It looks like the Parsec library is not thread safe. 

I just ran into the most peculiar problem using it, wherein a formerly reliable number parsing system built with Parsec, claims to have detected Left-Recursion after about 2500 numbers were thrown at it. And this happens in each of several parallel threads all trying to parse numbers.

I can reliably parse literally millions of number strings with it, when executed from a single thread (the Editor, or the REPL). 

But I see erorrs happen when there are at least 4 parallel threads all doing the same kind of work - taking tabular entries from an incoming database, splitting each line at the delimiters, and then calling on READ-FROM-STRING to read the numbers contained in those strings.

The numbers are all just plain decimal numbers with fractions, like 310.1023344. Nothing unusual about them.

If I surround the calls to READ-FROM-STRING with a plain vanilla READTABLE, then no errors arise because it no longer uses my Parseq parser.

If I have just one thread using the Parseq parser, no problem. 

So I am led to conclude that something in the Parseq library is not thread-safe.



_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html