{"id":15048057,"url":"https://github.com/robertoraggi/cplusplus","last_synced_at":"2025-04-05T00:09:25.118Z","repository":{"id":13394696,"uuid":"16082979","full_name":"robertoraggi/cplusplus","owner":"robertoraggi","description":"A compiler front end for the C++ language","archived":false,"fork":false,"pushed_at":"2024-10-23T20:43:13.000Z","size":4864,"stargazers_count":122,"open_issues_count":13,"forks_count":12,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-10-25T13:52:09.136Z","etag":null,"topics":["compiler","compiler-frontend","cpp","cpp20","cpp23","parser","preprocessor"],"latest_commit_sha":null,"homepage":"https://robertoraggi.github.io/cplusplus/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertoraggi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-20T20:48:36.000Z","updated_at":"2024-10-23T20:43:15.000Z","dependencies_parsed_at":"2023-01-13T17:27:16.233Z","dependency_job_id":"2136c4bf-ff8c-4cde-b8ec-ec9095795194","html_url":"https://github.com/robertoraggi/cplusplus","commit_stats":{"total_commits":706,"total_committers":3,"mean_commits":"235.33333333333334","dds":"0.0028328611898017497","last_synced_commit":"a4ed0132f07e70d597a8b04e4d1be853acf5f9e5"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertoraggi%2Fcplusplus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertoraggi%2Fcplusplus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertoraggi%2Fcplusplus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertoraggi%2Fcplusplus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertoraggi","download_url":"https://codeload.github.com/robertoraggi/cplusplus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266564,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","compiler-frontend","cpp","cpp20","cpp23","parser","preprocessor"],"created_at":"2024-09-24T21:07:32.859Z","updated_at":"2025-04-05T00:09:25.090Z","avatar_url":"https://github.com/robertoraggi.png","language":"C++","readme":"# A compiler front end for the C++ language\n\ncxx-frontend is a work-in-progress compiler frontend for C++23\n\nThe 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\nup-to-date with the latest language features and standards.\n\nThe API Reference is available at https://robertoraggi.github.io/cplusplus/docs/\n\n# Changelog and What's New\n\nFor updates, improvements, and recent features in cxx-frontend, please consult the [Changelog](CHANGELOG.md).\n\n# Key Features\n\n- **Syntax Analysis**: APIs to scan, preprocess, parse, and inspect the syntax of source code, making it a versatile tool for various code analysis tasks.\n\n- **Multi-Language Support**: In addition to C++, the library provides APIs for TypeScript and JavaScript.\n\n- **C++-23 Support**: Latest language enhancements, syntax, and features (WIP).\n\n## Syntax Checker and AST Browser Showcase\n\nStorybook and CodeMirror are used to demonstrate how to create a syntax checker and navigate the Abstract Syntax Tree (AST)\n\nhttps://robertoraggi.github.io/cplusplus/\n\n## Installing from npm\n\nTo integrate the latest stable version of the C++ Compiler Frontend bindings into your project, you can install them from npm:\n\n```sh\nnpm install cxx-frontend\n```\n\nOnce installed, you can use the bindings in your Node.js or web projects as needed.\n\n## Getting Started Using Example Projects\n\nThese projects are pre-configured and serve as starting points for various [use cases](https://github.com/robertoraggi/cplusplus/tree/main/templates).\n\nFor Node.js\n\n```sh\nnpx degit robertoraggi/cplusplus/templates/cxx-parse cxx-parse\ncd cxx-parse\nnpm install\nnode .\n```\n\nFor web-based applications, use these commands to clone, set up, and start a development server:\n\n```sh\nnpx degit robertoraggi/cplusplus/templates/cxx-browser-esm-vite cxx-browser-esm-vite\ncd cxx-browser-esm-vite\nnpm install\nnpm run dev\n```\n\n## Build the npm package (requires docker)\n\n```sh\n# prepare the package\nnpm ci\n\n# compile WASM and TypeScript code\nnpm run build:cxx-frontend\n```\n\n## Build for WASM/WASI (requires docker)\n\n```sh\nnpm ci\nnpm run build:wasi\n\n# run the C++ front end CLI tool using wasmtime\nwasmtime \\\n  --mapdir=/::build.wasi/install \\\n  --mapdir tests::tests \\\n  build.wasi/install/usr/bin/cxx.wasm -- \\\n  tests/manual/source.cc -ast-dump\n```\n\n## Native Build and CLI tools\n\nOn Linux, macOS and Windows:\n\n```sh\n# install the python packages required to run the unit tests (optional)\npip install -r tests/unit_tests/requirements.txt\n\n# configure the source code\ncmake . \\\n -G Ninja \\\n -B build \\\n -DCMAKE_BUILD_TYPE=Release \\\n -DCXX_INTERPROCEDURAL_OPTIMIZATION=1\n\n# build\ncmake --build build\n\n# run the unit tests\ncd build\nctest --progress\n```\n\n## Serialize the AST\n\nUse `-emit-ast` to serialize the AST of a C++ program to a flatbuffer binary file\n\n```sh\n# serialize the AST\n$ ./build/src/frontend/cxx -emit-ast source.cc -o source.ast\n```\n\nYou can use any flatbuffers supported decoder to read the AST, e.g.\n\n```sh\n# Use flatc to dump the AST to JSON\n$ ./build/_deps/flatbuffers-build/flatc --raw-binary -t build/src/parser/cxx/ast.bfbs  -- source.ast\n\n$ ll source.*\nsource.ast source.cc source.json\n```\n\n## License\n\nCopyright (c) 2025 Roberto Raggi roberto.raggi@gmail.com\n\nLicensed under the [MIT](LICENSE) license.\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertoraggi%2Fcplusplus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertoraggi%2Fcplusplus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertoraggi%2Fcplusplus/lists"}