<!-- https://tinyactors.dev/cli/commands/compile/ -->
# tinyactors compile

Kind: reference. For: [Workflow developer who tests](https://tinyactors.dev/audiences/workflow-tester.xml), [Agent-platform engineer](https://tinyactors.dev/audiences/agent-platform.xml).
Voice: [Reference](https://tinyactors.dev/voices/reference.xml).

> Compile charts or a system manifest into an image.

Compile charts or a system manifest into an image.

<a id="usage"></a>

## Usage

```shell
tinyactors compile [options] INPUT...
```

Compiles SCXML charts or one system manifest into a `.tai` image. The first chart is the image's default boot chart. Each static src is read relative to the file that names it, then in each `-I` directory. The answer lists the diagnostics and what the image holds. With `-o` -, the image goes to standard output and the answer to standard error.

<a id="options"></a>

## Options

- **`-W, --warnings-as-errors`**: Refuse a chart that compiles with a warning.
- **`-I, --include DIR`**: Search `DIR` for a src that is not beside the file naming it, in the order given. Repeatable.
- **`-o, --output FILE`**: Write the image to `FILE`, or to standard output when `FILE` is -.
- **`-e, --emit KIND`**: Write the image as `KIND`. Values: image (the image's bytes) or c (an 8-aligned C array). Default: image.
- **`-s, --symbol NAME`**: Name the C array `NAME` with `--emit` c; `NAME` is a C identifier. Default: tinyactors_image.

Configure output formats like `-f json` using the [shared options on the command reference](https://tinyactors.dev/cli/commands/index.md#program-options).

<a id="examples"></a>

## Examples

```shell
tinyactors compile order.scxml payment.scxml -o order.tai
```

```text title="output"
# Compile

- **Compiled**: yes
- **Output**: order.tai
- **Emit**: image
- **Bytes**: 3552
- **Hash**: b256b6cbfab69138
- **Charts**: 2
- **Boot actors**: 1

## Diagnostics

_none_
```

Compile two charts into one image.

```shell
tinyactors compile system.xml -o system.tai
```

```text title="output"
# Compile

- **Compiled**: yes
- **Output**: system.tai
- **Emit**: image
- **Bytes**: 3568
- **Hash**: 1c8ca2cc7138f14e
- **Charts**: 2
- **Boot actors**: 1

## Diagnostics

_none_
```

Compile a system manifest into an image.

```shell
tinyactors compile order.scxml --emit c --symbol order_image -o order_image.c
```

```text title="output"
# Compile

- **Compiled**: yes
- **Output**: order_image.c
- **Emit**: c
- **Bytes**: 2720
- **Hash**: 5e66ab57693504aa
- **Charts**: 1
- **Boot actors**: 1

## Diagnostics

_none_
```

Write the image as a C array named order_image.

```shell
tinyactors compile order.scxml -o - | tinyactors inspect -
```

```text title="output"
# Inspect

- **From**: image
- **Bytes**: 2720
- **Format**: 1
- **Hash**: 5e66ab57693504aa
- **Charts**: 1
- **Boot actors**: 1
- **Event names**: 18

## Sections

| Section | Offset | Bytes | Records |
| --- | --- | --- | --- |
| strings | 272 | 748 | 748 |
| charts | 1024 | 96 | 1 |
| states | 1120 | 384 | 6 |
| transitions | 1504 | 256 | 8 |
| words | 1760 | 136 | 34 |
| code | 1896 | 108 | 27 |
| expressions | 2008 | 224 | 14 |
| captures | 2232 | 40 | 2 |
| sends | 2272 | 112 | 2 |
| invokes | 2384 | 0 | 0 |
| data | 2384 | 36 | 3 |
| eventNames | 2424 | 288 | 18 |
| bootActors | 2712 | 8 | 1 |

## Charts

| Index | Name | Source | Datamodel | Binding | States | Transitions | Data | Expressions | Sends | Invokes | Code words |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 0 | order | order.scxml | ecmascript | early | 6 | 8 | 3 | 14 | 2 | 0 | 27 |

## Boot actors

| Name | Chart |
| --- | --- |
| order | order |
# Compile

- **Compiled**: yes
- **Output**: -
- **Emit**: image
- **Bytes**: 2720
- **Hash**: 5e66ab57693504aa
- **Charts**: 1
- **Boot actors**: 1

## Diagnostics

_none_
```

Compile to standard output and inspect the image.

<a id="exit-status"></a>

## Exit status

- **`1`**: An input is refused: it does not compile, or it is of an unknown format.
- **`3`**: An input cannot be read, the image cannot be written or memory runs out.

<a id="see"></a>

## Related pages

- **[`tinyactors check`](https://tinyactors.dev/cli/commands/check/index.md)**: Check that charts compile or that an image verifies.
- **[`tinyactors lint`](https://tinyactors.dev/cli/commands/lint/index.md)**: Find what cannot work as written in charts.
- **[`tinyactors fmt`](https://tinyactors.dev/cli/commands/fmt/index.md)**: Rewrite charts and system manifests in the canonical layout.

## Commands

- [tinyactors compile](https://tinyactors.dev/cli/commands/compile/)
- [tinyactors check](https://tinyactors.dev/cli/commands/check/)
- [tinyactors inspect](https://tinyactors.dev/cli/commands/inspect/)
- [tinyactors states](https://tinyactors.dev/cli/commands/states/)
- [tinyactors transitions](https://tinyactors.dev/cli/commands/transitions/)
- [tinyactors events](https://tinyactors.dev/cli/commands/events/)
- [tinyactors data](https://tinyactors.dev/cli/commands/data/)
- [tinyactors expressions](https://tinyactors.dev/cli/commands/expressions/)
- [tinyactors disassemble](https://tinyactors.dev/cli/commands/disassemble/)
- [tinyactors graph](https://tinyactors.dev/cli/commands/graph/)
- [tinyactors diff](https://tinyactors.dev/cli/commands/diff/)
- [tinyactors lint](https://tinyactors.dev/cli/commands/lint/)
- [tinyactors path](https://tinyactors.dev/cli/commands/path/)
- [tinyactors fmt](https://tinyactors.dev/cli/commands/fmt/)
- [tinyactors actors](https://tinyactors.dev/cli/commands/actors/)
- [tinyactors run](https://tinyactors.dev/cli/commands/run/)
- [tinyactors help](https://tinyactors.dev/cli/commands/help/)
- [tinyactors version](https://tinyactors.dev/cli/commands/version/)
