[cfe-dev] [RFC] A C++ pseudo parser for tooling

Vassil Vassilev via cfe-dev cfe-dev at lists.llvm.org
Fri Nov 5 10:22:31 PDT 2021


Hi Haojian,

   I remember the netbeans C++ autocompletion had such 'inaccurate' but 
fast parser. I was wondering if you looked at this and if there is other 
prior art in the area.

   Long time ago I believe I talked with Vladimir about that. Adding him 
in cc.

Best, Vassil


On 11/5/21 3:37 PM, Haojian Wu via cfe-dev wrote:
> Hello everyone,
>
> We’d like to propose a pseudo-parser which can approximately parse C++ 
> (including broken code). It parses a file in isolation, without 
> needing headers, compile flags etc. Ambiguities are resolved 
> heuristically, like clang-format. Its output is a clang::syntax tree, 
> which maps the token sequence onto the C++ grammar.
> Our motivation comes from wanting to add some low latency features 
> (file outline, refactorings etc) in clangd, but we think this is a 
> useful building block for other tools too.
>
> Design is discussed in detail here: 
> https://docs.google.com/document/d/1eGkTOsFja63wsv8v0vd5JdoTonj-NlN3ujGF0T7xDbM/edit?usp=sharing 
> <https://docs.google.com/document/d/1eGkTOsFja63wsv8v0vd5JdoTonj-NlN3ujGF0T7xDbM/edit?usp=sharing>
>
> The proposal is based on the experience with a working prototype. 
> Initially, we will focus on building the foundation. We consider the 
> first version as experimental, and plan to use and validate it with 
> applications in clangd (the detailed plan is described here 
> <https://docs.google.com/document/d/1eGkTOsFja63wsv8v0vd5JdoTonj-NlN3ujGF0T7xDbM/edit#heading=h.mawgmexy688j>).
>
>
> As soon as we have consensus on the proposal, we plan to start this 
> work in the clang repository (code would be under 
> clang/Tooling/Syntax). We hope we can start sending out patches for 
> review at the end of November.
>
> Eager to hear your thoughts. Comments and suggestions are much 
> appreciated.
>
> Thanks,
> Haojian
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211105/8bd4033d/attachment.html>


More information about the cfe-dev mailing list