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.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/3858#issuecomment-2076701349
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/issues/3858/[email protected]>

Reply via email to