1개월 전 · Jul 6, 2026 2:06 AM
Why modern IDEs (VS Code, Neovim) use Tree-sitter instead of traditional Bison/Flex parsers:
- Traditional LR Parsers: Require re-parsing the entire file from byte 0 on every keystroke, failing completely if there is a syntax error.
- Tree-sitter Incremental Parsing:
- Re-parses only the modified syntax subtree in $<1\text{ millisecond}$.
- Robust error recovery: if a user leaves an unclosed parenthesis
(, Tree-sitter marks that node as error and cleanly parses the rest of the file! - Emits concrete syntax trees (CST) with exact byte offsets for instant syntax highlighting.