Name Date Size #Lines LOC

..13-Mar-2025-

benchmarks/H13-Mar-2025-167129

fuzzer/H13-Mar-2025-11781

gen/H13-Mar-2025-136106

include/H13-Mar-2025-1,818832

lib/H13-Mar-2025-4,1273,216

test/H13-Mar-2025-598234

tool/H13-Mar-2025-870683

unittests/H13-Mar-2025-1,9091,505

CMakeLists.txtH A D13-Mar-2025320 1312

DesignNotes.mdH A D13-Mar-20254.7 KiB12492

README.mdH A D13-Mar-20251.6 KiB3825

README.md

1# clang pseudoparser
2
3This directory implements an approximate heuristic parser for C++, based on the
4clang lexer, the C++ grammar, and the GLR parsing algorithm.
5
6It parses a file in isolation, without reading its included headers.
7The result is a strict syntactic tree whose structure follows the C++ grammar.
8There is no semantic analysis, apart from guesses to disambiguate the parse.
9Disambiguation can optionally be guided by an AST or a symbol index.
10
11For now, the best reference on intended scope is the [design proposal],
12with further discussion on the [RFC].
13
14## Dependencies between pseudoparser and clang
15
16Dependencies are limited because they don't make sense, but also to avoid
17placing a burden on clang mantainers.
18
19The pseudoparser reuses the clang lexer (clangLex and clangBasic libraries) but
20not the higher-level libraries (Parse, Sema, AST, Frontend...).
21
22When the pseudoparser should be used together with an AST (e.g. to guide
23disambiguation), this is a separate "bridge" library that depends on both.
24
25Clang does not depend on the pseudoparser at all. If this seems useful in future
26it should be discussed by RFC.
27
28## Parity between pseudoparser and clang
29
30The pseudoparser aims to understand real-world code, and particularly the
31languages and extensions supported by Clang.
32
33However we don't try to keep these in lockstep: there's no expectation that
34Clang parser changes are accompanied by pseudoparser changes or vice versa.
35
36[design proposal]: https://docs.google.com/document/d/1eGkTOsFja63wsv8v0vd5JdoTonj-NlN3ujGF0T7xDbM/edit
37[RFC]: https://discourse.llvm.org/t/rfc-a-c-pseudo-parser-for-tooling/59217/49
38