patrickhuber / Pliant

MIT License
26 stars 4 forks source link

add incremental reparse to avoid reparsing the entire doc #9

Open patrickhuber opened 9 years ago

patrickhuber commented 9 years ago

Incremental reparsing reduces the time to compile changes into a document.

more information here (dead link) more information here also: here

ArsenShnurkov commented 7 years ago

the link is no longer valid

An error occurred while processing your request.
Reference #50.9584dd58.1499694555.1cf3c26f

or

Access Denied
You don't have permission to access "http://delivery.acm.org/10.1145/1700000/1697247/p61-kallmeyer.pdf" on this server.
Reference #18.9584dd58.1499703476.1d2db9d8 

full list of publications: https://user.phil.hhu.de/~kallmeyer/publications.html

probably it was Laura Kallmeyer and Wolfgang Maier (2009): An Incremental Earley Parser for Simple Range Concatenation Grammar. In Proceedings of IWPT 2009, Paris, 61-64.

patrickhuber commented 7 years ago

Thanks, I added an additional link and updated the link to the one you supplied.

ArsenShnurkov commented 7 years ago

Please also consider bidirectional parsing (from end to start) in addition to incremental parsing. Syntax tree doesn't have direction. So it is possible to perform scanning from the end of document (and from the start of document at the same time). This will simplify syntax highlighting implementation for the use case of small changes in text editor.

patrickhuber commented 7 years ago

Reading from the stream backwards should be a trivial implementation, but does something special need to be done to the grammar for this to work with the earley algorithm?

ArsenShnurkov commented 7 years ago

reading backwards alone is not enough. Image source text like "#include int main() { return 0;}". When you read it backwards it starts from } and not from #. So definitely the grammar should be processed differently. And it's the algorithm what should be created, not grammar (the same grammar will be used for both the forward and the backward parsings).