ChaiScript embeds a scripting runtime in C++ applications with type-safe callbacks, STL integration, and eval of strings or script files from a header-only package.
Overview
ChaiScript is an embedded scripting language aimed directly at C++ projects. It ships as header-only sources that link into existing applications without a separate preprocessor or external runtime library.
The engine keeps type safety between host C++ code and user scripts and supports registering callbacks, overloaded functions, class methods, and STL containers. After creating a `chaiscript::ChaiScript` instance, hosts run snippets with `eval` or whole files with `evalfile`, and expose C++ callables via `add`.
The syntax resembles ECMAScript with adjustments for ease of use. A formal EBNF grammar is published for language reference.
A C++17 toolchain with variadic template support is required, with testing reported on Windows with MSVC, and with gcc and clang on other platforms. Installation is also available through the vcpkg package manager.
Key features
- Header-only C++ integration
- Type-safe script bindings
- eval and evalfile execution
- C++ callbacks and class methods
- STL container support
- Thread-safe mode (configurable)
- vcpkg packaging
Use cases
- In-app scripting for C++ programs
- User-defined logic without recompiling
- Game or tool configuration scripts