C*: Unifying Program and Proof in C

Installing the C* Toolchain

EN | 中文

C* currently supports the platforms darwin-x64darwin-x64, darwin-aarch64darwin-aarch64, and linux-x64linux-x64. There is no native Windows support yet; Windows users can use the C* toolchain through WSL or Docker.

Install via the VSCode Extension (Recommended)

  1. In VSCode, search for and install the CStar Language extension (pre-release).
  2. Open the command palette with ctrl+shift+pctrl+shift+p (or shift+cmd+pshift+cmd+p on macOS), then type and select CStar IDE: Download CStar ToolchainCStar IDE: Download CStar Toolchain.
  3. Confirm in the dialog that the install script will be fetched from https://cstarlang.orghttps://cstarlang.org, and click “Yes” to start the download.
  4. Once the download finishes, VSCode will prompt you to restart and enable the extension; if no prompt appears, restart VSCode manually.
  5. Create a new folder (e.g. hellohello), initialize a C* project inside it (e.g. cd hello ; cstarc initcd hello ; cstarc init), and open it in VSCode.
  6. Point clangdclangd at the C*-modified build (cst_clangdcst_clangd) for a better editing experience.

    • Option 1: set the workspace clangd.pathclangd.path to cst_clangdcst_clangd via the VSCode settings UI.
    • Option 2: add { "clangd.path": "cst_clangd" }{ "clangd.path": "cst_clangd" } to .vscode/settings.json.vscode/settings.json.
    • If C* files are still reported as having unrecognized C* syntax while editing, restart VSCode again.

Install from the Command Line

  1. On Linux or macOS, run curl -fsSL https://cstarlang.org/install/unix.sh | bashcurl -fsSL https://cstarlang.org/install/unix.sh | bash.
  2. Run cstarc --helpcstarc --help for usage of the command-line tool.

Use the Prebuilt Docker Image

We provide a prebuilt Docker image with the C* toolchain built in. It can be used as a VSCode dev container, with no need to install the toolchain locally.

  1. Pull the prebuilt image: docker pull stonebuddha/cstar:latestdocker pull stonebuddha/cstar:latest.
  2. Create .devcontainer/devcontainer.json.devcontainer/devcontainer.json in your project root with the contents below.
  3. Install the Dev Containers extension in VSCode, then run the command Dev Containers: Reopen in ContainerDev Containers: Reopen in Container.
{
"name": "C* (CStar)",
"image": "stonebuddha/cstar:latest",
"customizations": {
"vscode": {
"extensions": [
"cstar-team.cstarlang@prerelease",
"llvm-vs-code-extensions.vscode-clangd"
],
"settings": {
"clangd.path": "cst_clangd",
"clangd.checkUpdates": false
}
}
}
}
{
"name": "C* (CStar)",
"image": "stonebuddha/cstar:latest",
"customizations": {
"vscode": {
"extensions": [
"cstar-team.cstarlang@prerelease",
"llvm-vs-code-extensions.vscode-clangd"
],
"settings": {
"clangd.path": "cst_clangd",
"clangd.checkUpdates": false
}
}
}
}