Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to parse a stream of characters #70

Open
neilweber opened this issue Nov 15, 2019 · 1 comment
Open

Add the ability to parse a stream of characters #70

neilweber opened this issue Nov 15, 2019 · 1 comment
Assignees

Comments

@neilweber
Copy link

neilweber commented Nov 15, 2019

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.

@renggli renggli self-assigned this Nov 15, 2019
@renggli
Copy link
Member

renggli commented Nov 15, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants