Documentation

ChaiScript is a scripting language that easily embeds into your existing C++ applications. It's built to be flexible and dynamic, yet still maintain the type-safety you expect as a C++ user. It can natively use classes, methods, and attributes, even if the class inherits functionality from a parent class.

As of 2.0, it also supports exceptions and automatic thread-safety.

As of 3.0.0, the online documentation is deprecated and all official documentation is part of the source code in the form of Doxygen style comments.

Release 3.1.0 Doxygen generated Documentation

Release 3.0.0 Doxygen generated Documentation

Getting Started

Getting the source

The latest source is hosted at github. To grab the latest release, go here. For the more adventurous, you can get the latest source code here.

Getting Boost

ChaiScript requires Boost (at least 1.34), which you can get here.

Compiling the evaluator

Use cmake to generate a project appropriate for your platform.

In Unix, after configuring the project with cmake, type

make chai

In Windows, open the generated .sln file and build the "chai" target.

If you would prefer to compile by hand:

cd chaiscript
./g++ -Iinclude -I<path to Boost> src/main.cpp -o chaiscript_eval

Using the evaluator

In Windows:

chai.exe
eval>

In Linux and OS X:

./chai
eval>

The evaluator allows you to evaluate ChaiScript expressions. This is a great way to get a feel for the language. You can also pass ChaiScript source files to the evaluator from the commandline to run them as standalone scripts.

Starting an example project

The minimal ChaiScript project requires only a few lines:

#include <chaiscript/chaiscript.hpp>
int main() {
  using namespace chaiscript;
 
  ChaiScript chai;
  chai.eval("print(\"Hello, world\")");
 
  return 0;
}

For more examples, see the official documentation.