nodejs / llparse

Generating parsers in LLVM IR
http://llparse.org
Other
584 stars 30 forks source link

streaming parser #29

Closed drom closed 4 years ago

drom commented 4 years ago

I am building VCD (Value Change Dump) parser using llparse. These types of files can grow very big >1GB. Is it possible to implement streaming parser using llparse? The idea is to feed it chunk by chunk and keep state between chunks.

indutny commented 4 years ago

Totally! The parser will save the state and wait for more data. Just call _execute() for each successive chunk.

drom commented 4 years ago

I struggle to make it work. Since the first chunk _execute() was incomplete, it produced an error. Second _execute() did not even run for some reason?

Here is the test: https://github.com/wavedrom/vcd/blob/master/test/basic.js#L49