Show HN: Cppbolt – A lightweight C++ to WebAssembly compiler written in Rust git...
Show HN @show
Show HN: Cppbolt – A lightweight C++ to WebAssembly compiler written in Rust github.com · 3 points · 1 comments · HN thread
TL;DR cppbolt is an open-source, work-in-progress C++ to WebAssembly compiler written in Rust that handles a defined subset of C++17 without LLVM, Clang or Emscripten, aiming for a compiler payload of about 1 MB instead of 100+ MB. It ships as a CLI, a browser playground and an npm package. The single HN comment is a brief suggestion to benchmark it against an AI-based conversion approach.
- Compiles a subset of C++17 directly to standard WebAssembly binaries with no dependency on LLVM, Emscripten or native toolchains.
- The compiler payload is said to be about 1 MB, compared with 100+ MB for projects that bundle LLVM/Clang.
- Supported features include classes, inheritance, virtual functions, operator overloading, templates, a subset of the standard library, pointers, references, lambdas, structured bindings and range-based loops.
- Not supported per the docs: full C++17, standard containers and algorithms, exceptions and RTTI.
- Available as a CLI, a browser playground that runs the compiler in a Web Worker, and an npm package with a host runtime.
- Licensed under Apache 2.0; the author is seeking feedback on architecture and potential use cases.
Links in the post
- cppbolt browser playground: In-browser playground for compiling and running a subset of C++17, with example loading and an output panel.
- cppbolt documentation (mdBook): Project docs covering getting started, the supported C++ feature matrix, browser integration, diagnostics, compiler architecture, testing and contributing.
- cppbolt on npm: The npm package page; it could not be read, so its contents are not described here.
Discussion The thread is very small, with one top-level comment and no replies. It is mildly positive: the commenter agrees that WebAssembly is useful for cross-platform apps and that converting existing C++ code is valuable. The discussion does not engage with the compiler's design or its limitations.
- WebAssembly helps move existing C++ code to cross-platform apps (some): The sole commenter argues that the large body of existing C++ code and optimized libraries makes a C++ to WebAssembly path highly useful.
- Benchmark cppbolt against AI-based code conversion (a few): The commenter suggests trying an LLM such as Claude to convert a C++ project to WebAssembly and comparing the result with cppbolt on quality and speed.