Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What do you think about Tree-sitter? #3858

Open
iahung4 opened this issue Apr 25, 2024 · 1 comment
Open

What do you think about Tree-sitter? #3858

iahung4 opened this issue Apr 25, 2024 · 1 comment

Comments

@iahung4
Copy link

iahung4 commented Apr 25, 2024

It's a more modern and advanced parser than ctags:

https://tree-sitter.github.io/tree-sitter/

@elextr
Copy link
Member

elextr commented Apr 25, 2024

Parsing is not sufficient for new languages, it needs semantics as well.

For example inferred types need semantics like type evaluation of expressions, for example C++ auto f = 1 + 1.0; has to know the semantics of mixed type arithmetic 1 + 1.0 to get the result type as float and then bind that type to f. New languages like Julia and Rust and Go, many functional languages like Haskell and Ocaml and retrofits to languages like C++ and Java provide capabilities like this.

Type evaluation of expressions requires full knowledge of visibility, what parts of the system libraries and user code is visible at the point of set(a, 1); to decide which set() function is going to be called (there are lots of set() functions in libraries and user code), and so what the return type is, so it can be used in auto a1 = set(a, 1); as the type of a1.

It needs more than a parser to perform these computations. The current technology solving it is the Language Server Protocol which is a way for the IDE to send the work to a separate process that contains most of the compiler except the code generation so the workload of a compiler does not interrupt the UI. Many language projects are providing LSP compliant servers, like clangd from the clang C/C++ compiler project or gopls from the Go language project.

There is work in progress to integrate such servers with Geany.

Edit: Just to be clear, while some of the ctags parsers could be improved, the effort of changing all the support infrastructure to a different set of parsers isn't worth it. Until the proper solution is available spend the effort improving ctags parsers (within its limitations) and a bunch of other projects will benefit as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants