Re:We Need to Know LR and Recursive Descent Parsing Techniques
by DannyBee on Wednesday January 18, 2023 @10:04AM
(#34427451)
I implemented it for ANTLR (which is LL(*), so not fully recursive descent, but top-down) but never got around to shepherding the patches through.
https://github.com/dberlin/antlr4ts/blob/incremental/Increme...
and the commits on that branch should give you some idea.
I have java support somewhere for the non-TS target as well.
I'm happy to chat about it elsewhere as well, drop me a line at my email.
Let's say I've parsed an AST
and I've detected that `rhs` on line 3 has changed. So I go back to the start of the node. What do I do then? How do I know I need to parse an expression there and that it belongs to the rhs of a binary expression?In the literature, this is solved by storing the parse state. How do you do that with recursive descent?
Is there something you'd recommend reading to understand how to do incremental parsing for recursive descent specifically?