> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
$schema: https://holocron.so/frontmatter.json
title: Getting Started
description: Install the RoboC++ compiler and run your first IEC 61131-3 program from the rbcpp CLI or browser Studio.
icon: lucide:rocket
---

## Prerequisites

RoboC++ is a **Rust workspace**. Install **Rust 1.76 or newer** (see `rust-version` in the root `Cargo.toml`), then run commands from the repository root.

```bash
cargo build
```

<Aside>
  <Note>
    During development, invoke the CLI through **`cargo run -p rbcpp_cli --`** instead of installing a global `rbcpp` binary.
  </Note>
</Aside>

## RoboC++ Studio (browser IDE)

If you prefer a graphical workflow, run **RoboC++ Studio** from **`ide/web`**:

```bash
cd ide/web
npm install
npm run dev
```

Open **`http://127.0.0.1:5173`**, load the **PackagingLine** sample, and use **F7** (check) and **F5** (simulate). Build the WASM language service with **`npm run wasm:build`** for full compiler-backed analysis. See [Studio getting started](/studio-getting-started) and [RoboC++ Studio](/studio).

## First run

Use the CLI crate through Cargo while developing:

```bash
cargo run -p rbcpp_cli -- run examples/counter.st --cycles 3
```

The **`counter.st`** example increments `Count` until it reaches `Limit`:

```text
PROGRAM CounterDemo
VAR
    Count : INT := 0;
    Limit : INT := 3;
    Done  : BOOL := FALSE;
END_VAR

IF Count < Limit THEN
    Count := Count + 1;
ELSE
    Done := TRUE;
END_IF;
END_PROGRAM
```

You should see human-readable output similar to:

```text
program: CounterDemo
cycle 0
  COUNT = 1
  ...
cycle 2
  DONE = TRUE
```

Variable names in traces are **uppercased** from the internal environment snapshot.

## Check before running

Run **semantic checks** when you want diagnostics without executing the program:

```bash
cargo run -p rbcpp_cli -- check examples/counter.st
```

Add **`--json`** when another tool needs machine-readable diagnostics. See [Diagnostics](/diagnostics) for stable `RBCPP-*` codes.

## Build C

Generate **portable C** for a supported program:

```bash
cargo run -p rbcpp_cli -- build-c examples/counter.st -o build/counter.c
```

The backend validates the project first, then writes the generated source to the requested path (or stdout when **`-o`** is omitted).

<Aside>
  <Info>
    Generated C includes **scan functions**, state structs, **`_set_target_hooks`** for `%I`/`%Q`/`%M` and retained variables, **`rbcpp_io_symbols`** metadata, optional comm hooks, and an **SPDX license header** (`MIT OR Apache-2.0`). See [Targets and Generated C](/targets) and [License](/license).
  </Info>
</Aside>

## License

RoboC++ is dual-licensed under **MIT OR Apache-2.0**. See [License](/license) for source and generated C terms.

## Next steps

<CardGroup cols={2}>
  <Card title="RoboC++ Studio" icon="lucide:layout-panel-left" href="/studio-getting-started">
    Run the browser IDE locally with WASM language service.
  </Card>

  <Card title="CLI reference" icon="lucide:terminal" href="/cli">
    All commands, profiles, and flags.
  </Card>

  <Card title="Examples" icon="lucide:folder-open" href="/examples">
    All repository examples (.st, .il, .sfc, .ld, .fbd, .xml).
  </Card>

  <Card title="Structured Text" icon="lucide:braces" href="/structured-text">
    Statements and expressions in the supported ST subset.
  </Card>

  <Card title="Execution model" icon="lucide:repeat" href="/execution-model">
    Configurations, tasks, and JSON traces.
  </Card>
</CardGroup>


---

*Powered by [holocron.so](https://holocron.so)*
