Recommend a parsing library for LibPQ.jl?

iamed2
Mon, 13 Mar 2023 18:38:08 +0000
Data

I’m looking to improve the parsing code in LibPQ and expand support for more data types. PCRE2 is expensive and heavyweight, but it’s a challenge to write each parser from scratch and I don’t want to reinvent the wheel. The stdlib Dates parser is also broken for basic timestamps with time zones with optional fractional seconds so I’d like to improve performance for date parsing by writing a new one for PostgreSQL’s ISO 8601 format.

My requirements are:

less memory and execution time than regex

performs well parsing small strings one at a time (i.e. doesn’t require parsing a whole file at a time to reach good amortized performance)

handles escaping and quoting (like you might expect to encounter in CSV files)

My ideal features (not necessary):

composable (if I have a Foo parser I can use it with an Array parser to parse Arrays of Foo)

can parse UTF8 AbstractStrings as well as arbitrary bytes

can parse regions in a string (from one position to either a second position or a sentinel)

documented, maintained, tested

Does anyone have recommendations? I can see there are lots of parsing libraries but I’m not sure which are still active and which would be the best for my use case.

2 posts - 2 participants