dart-petitparser icon indicating copy to clipboard operation
dart-petitparser copied to clipboard

Add the ability to parse a stream of characters

Open neilweber opened this issue 5 years ago • 1 comments

For a project I am working on uncompressed data files can be very large (easily 500k). I'd rather not load and hold the entire file in memory to parse it. Instead, I want to stream in characters as needed.

neilweber avatar Nov 15 '19 03:11 neilweber

This is tricky to do in a generic way with a framework like this. PetitParser needs random access on the input data, because of backtracking. However, depending on your grammar, you can split up the parser and run it incrementally over junks of input data. An example is this event based XML parser that can efficiently process infinitely large streams of input.

renggli avatar Nov 15 '19 23:11 renggli