3 ms·
For error recovery, do any parsers have a notion of which tokens are more likely to be wrong? For example, in an actively edited C++ file, braces are more like
by tlb 6y ago
For error recovery, do any parsers have a notion of which tokens are more likely to be wrong?
For example, in an actively edited C++ file, braces are more likely correct than angle brackets which are overloaded. So it's reasonable to auto-insert closing > if you see a } with an open <, but not reasonable to insert a } if you see a > with an open <.
- ltratt 6y ago> For error recovery, do any parsers have a notion of which tokens are more likely to be wrong? lrpar has a %avoid_insert declaration which allows users to say "these token types are better avoided if there are other equivalently good repair sequences". It's simple, but it works well https://softdevteam.github.io/grmtools/master/book/errorrecovery.html#biasing-repair-sequences https://softdevteam.github.io/grmtools/master/book/errorreco...
- maxbrunsfeld 6y agoI like this solution, and have thought about adding something similar as an "advanced feature" in Tree-sitter grammars. I'm interested to see how you've used it in grammars.
- raphlinus 6y agoTo the extent that there will be further research on this problem, I think it will be driven by machine learning. We're already seeing this with autocompletion with TabNine, and no reason a similar approach couldn't work for the other issues facing draft code. If you had a large dataset of keystroke-by-keystroke edit streams, you'd be able to match up erroneous code with the eventual fix. Google or Facebook could absolutely capture these datasets for their internal work if they wanted, and I suspect the results could be scary-good. They wouldn't be able to release the models, though, even for their open source work (Chromium and Android), because it would have such a high chance of revealing internal secrets.
- the_duke 6y agoI haven't used it, but Microsoft is already offering machine learning based completions with IntelliCode [1]. See also the introductory blog post. [2] It also offers sharing refined predictions within teams. I think we will see some interesting developments in this domain over the next few years. [1] https://visualstudio.microsoft.com/services/intellicode/ https://visualstudio.microsoft.com/services/intellicode/ [2] https://devblogs.microsoft.com/visualstudio/ai-assisted-intellisense-for-your-teams-codebase/ https://devblogs.microsoft.com/visualstudio/ai-assisted-inte...