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

---
$schema: https://holocron.so/frontmatter.json
title: IL and SFC
description: Instruction List operators and Sequential Function Chart support in the IEC 61131-3 compiler.
icon: lucide:git-branch
---

## Instruction List

IL is **`implemented`** for semicolon-delimited and line-oriented textual IL in the supported regression suite. Compliance rows cover instructions, parenthesized operands, accumulator operators, jumps, returns, and FB invocation.

Implemented foundations include:

* Core accumulator operators (`LD`, `ST`, `AND`, `OR`, `XOR`, `NOT`, arithmetic, and related forms)
* Typed mnemonic suffixes and **`N`** modifier variants
* Labels and jumps (`JMP`, `JMPC`, `JMPCN`)
* Function block calls (`CAL`, `CALC`, `CALCN`) with positional inputs and `VAR_IN_OUT` copy-back
* Conditional returns (`RET`, `RETC`, `RETCN`)
* Parenthesized operand expressions and nested IL expression lists
* IL bodies inside user-defined function blocks (unique inlined labels in generated C)

Examples:

| File                        | Focus                                   |
| --------------------------- | --------------------------------------- |
| `instruction_list.il`       | Basic operators (standalone `.il` file) |
| `instruction_list_calls.st` | FB calls                                |
| `instruction_list_jumps.st` | Labels and jumps                        |

```bash
cargo run -p rbcpp_cli -- check examples/instruction_list.st
cargo run -p rbcpp_cli -- run examples/instruction_list.st --cycles 2
```

IL bodies are checked, executed with the **accumulator model**, and emitted to C when within the supported subset.

### IL transition bodies in SFC

Textual SFC transitions accept either a **BOOL ST expression** or an **IL accumulator body** between the transition header and **`END_TRANSITION`**:

```text
TRANSITION FROM Start TO Done:
    LD Count
    GE 2
END_TRANSITION;
```

The IL sequence lowers to a BOOL condition for transition firing. **Native `LADDER` and `FBD` blocks** are also valid SFC transition bodies. See [Native LD and FBD](/native-ld-fbd).

Standalone **`.il`** files use the same loader as **`.st`**. See **`examples/instruction_list.il`** in [Examples](/examples).

## Sequential Function Chart

Textual SFC in `.st` projects, standalone **`.sfc`** files, and graphical SFC from PLCopen import include:

* Steps, **initial** step flags, and macro steps (graphical)
* Transitions with **ST expressions** or **IL accumulator bodies**, plus priorities, divergence, and convergence
* Actions bound to steps (ST bodies)
* Action qualifiers **`N`**, **`S`**, **`R`**, **`P`**, **`P0`**, **`L`**, **`D`**, **`SD`**, **`DS`**, **`SL`**
* Action-control aggregation, timed-association contention diagnostics, and jump targets

The runtime uses a deterministic SFC interpreter: transition fire flags are computed before step updates to match generated C scan semantics.

<Aside>
  <Info>
    Run **`rbcpp sfc-compliance`** to inspect compatible and minimal SFC compliance-set status for the active profile. All four SFC compliance-set rows are **`implemented`** for **`2003-strict`** today.
  </Info>
</Aside>

Examples:

| File                | Focus                                   |
| ------------------- | --------------------------------------- |
| `sfc_sequence.st`   | Steps, transitions, actions             |
| `sequence.sfc`      | Textual SFC in a standalone `.sfc` file |
| `sfc_qualifiers.st` | Qualifier syntax and runtime behavior   |

SFC structure round-trips through [PLCopen](/plcopen) XML.

## Related

* [Structured Text](/structured-text): action bodies
* [Compliance](/compliance): `language.il` and `sfc` rows


---

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