llvm-capstone/clang-tools-extra/pseudo
Jon Roelofs 2fb1c1082c
cmake: add missing dependencies on ClangDriverOptions tablegen
The modules build trips over this frequently because there is no textual
include of the tablegen output, but the module includes it.

Differential revision: https://reviews.llvm.org/D157119
2023-08-04 10:27:19 -07:00
..
benchmarks
fuzzer
gen
include Replace None with std::nullopt in comments (NFC) 2023-05-12 18:33:26 -07:00
lib cmake: add missing dependencies on ClangDriverOptions tablegen 2023-08-04 10:27:19 -07:00
test [NFC][Py Reformat] Reformat python files in clang and clang-tools-extra 2023-05-23 08:29:52 +02:00
tool
unittests
CMakeLists.txt
DesignNotes.md
Disambiguation.md
README.md

clang pseudoparser

This directory implements an approximate heuristic parser for C++, based on the clang lexer, the C++ grammar, and the GLR parsing algorithm.

It parses a file in isolation, without reading its included headers. The result is a strict syntactic tree whose structure follows the C++ grammar. There is no semantic analysis, apart from guesses to disambiguate the parse. Disambiguation can optionally be guided by an AST or a symbol index.

For now, the best reference on intended scope is the design proposal, with further discussion on the RFC.

Dependencies between pseudoparser and clang

Dependencies are limited because they don't make sense, but also to avoid placing a burden on clang mantainers.

The pseudoparser reuses the clang lexer (clangLex and clangBasic libraries) but not the higher-level libraries (Parse, Sema, AST, Frontend...).

When the pseudoparser should be used together with an AST (e.g. to guide disambiguation), this is a separate "bridge" library that depends on both.

Clang does not depend on the pseudoparser at all. If this seems useful in future it should be discussed by RFC.

Parity between pseudoparser and clang

The pseudoparser aims to understand real-world code, and particularly the languages and extensions supported by Clang.

However we don't try to keep these in lockstep: there's no expectation that Clang parser changes are accompanied by pseudoparser changes or vice versa.