cxx-frontend is a work-in-progress compiler frontend for C++26 and C23
The compiler frontend is designed to be a powerful tool for developers, enabling them to parse, analyze, and modify C++ source code. This project aims to provide a robust foundation for building a complete C++ frontend, staying up-to-date with the latest language features and standards.
The API Reference is available at https://robertoraggi.github.io/cplusplus/docs/
For updates, improvements, and recent features in cxx-frontend, please consult the Changelog.
- 
Syntax Analysis: APIs to scan, preprocess, parse, and inspect the syntax of source code, making it a versatile tool for various code analysis tasks.
 - 
Multi-Language Support: In addition to C++, the library provides APIs for TypeScript and JavaScript.
 - 
C++-26 and C23 Support: Latest language enhancements, syntax, and features (WIP).
 
The playground uses the Monaco Editor to demonstrate how to create a syntax checker and navigate the Abstract Syntax Tree (AST).
https://robertoraggi.github.io/cplusplus/
On Linux, macOS and Windows:
install the python packages required to run the unit tests (optional)
uv sync && source .venv/bin/activateconfigure the source code
cmake --preset defaultbuild
cmake --build buildrun the unit tests
cd build
ctest --progressDump the AST to stdout
 ./build/src/frontend/cxx tests/manual/source.cc -ast-dumpprepare the package
npm cicompile WASM and TypeScript code
npm run build:cxx-frontendnpm ci
npm run build:wasirun the C++ front end CLI tool using wasmtime
wasmtime \
  --mapdir=/::build.wasi/install \
  --mapdir tests::tests \
  build.wasi/install/usr/bin/cxx.wasm -- \
  tests/manual/source.cc -ast-dumpTo integrate the latest stable version of the C++ Compiler Frontend bindings into your project, you can install them from npm:
npm install cxx-frontendOnce installed, you can use the bindings in your Node.js or web projects as needed.
These projects are pre-configured and serve as starting points for various use cases.
For Node.js
npx degit robertoraggi/cplusplus/templates/cxx-parse cxx-parse
cd cxx-parse
npm install
node .For web-based applications, use these commands to clone, set up, and start a development server:
npx degit robertoraggi/cplusplus/templates/cxx-browser-esm-vite cxx-browser-esm-vite
cd cxx-browser-esm-vite
npm install
npm run devCopyright (c) 2025 Roberto Raggi [email protected]
Licensed under the MIT license.