3 ms·
Is the use case for this mainly IDEs or is it intended to replace traditional lexer and parser generators too?
by guerrilla 6y ago
Is the use case for this mainly IDEs or is it intended to replace traditional lexer and parser generators too?
- patrec 6y agoI have used tree-sitter, but only for a very simple use case. The main shortcoming I am aware of are error messages, see here: https://github.com/tree-sitter/tree-sitter/issues/255 https://github.com/tree-sitter/tree-sitter/issues/255 Tree sitter will basically always generate a parse tree, even for malformed input, in which case it will add ERROR nodes for the bits it doesn't like (it will also inform you that there were problems with the parse by setting a boolean attribute). So you have some information you can use to construct a useful error message yourself, but some parser generators will handle this better (although it has to be said that the difficulty of obtaining good error messages from a parser generator are still one of the main the reasons production parsers are mostly written by hand).
- guerrilla 6y agoAh I see, so the reparation isn't avoidable for now? That doesn't seem very appropraite for compilers then.
- patrec 6y agoWhy would it not be appropriate? The only annoyance I see is that currently you will have to generate a good error message from it yourself, but a first pass at the problem shouldn't be too onerous.
- guerrilla 6y agoOk, I misunderstood. I thought it repaired without error sometimes but I see that you were clear that that isn't the case.
- dcreager 6y agoWe are also using this to power a lot of the program analysis features on github.com. We use it to generate the symbol list for Code Navigation, as an example, and are starting to look at extracting more semantic information about some languages using tree-sitter parse trees as intermediaries.