> ## Documentation Index
> Fetch the complete documentation index at: https://e33f2ad-archee-studio.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://e33f2ad-archee-studio.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://e33f2ad-archee-studio.manicule.dev/api/mcp.
> Every agent surface: https://e33f2ad-archee-studio.manicule.dev/.well-known/llms-manifest.json

# Syntax (/arc/syntax)

<!-- agent-signals: reading_time_min: 3 · est_tokens: 750 · updated: 2026-12-05 -->
Related: [The .arc language](/arc/overview.md), [Units and expressions](/arc/units.md), [Parts, ports and mates](/arc/parts.md), [Citations](/arc/citations.md), [Sheets and reports](/arc/sheets.md), [Diagnostics](/arc/diagnostics.md)

> Files, identifiers, comments and the declarations of a .arc file.

## Source text

* UTF-8, NFC, LF line ends, 2-space indent, no tabs.
* A comment runs from `//` to the end of the line.
* An identifier matches `[A-Za-z][A-Za-z0-9_]*`. Vietnamese (tiếng Việt) appears only in strings: labels such as `"Bảng 10.5"`, prose and titles.
* A number is `12`, `0.97`, `1.5e3` or `12_000`.
* A string is `"..."` with `\"` and `\\`. Only `prose` strings interpolate `{ref}`.
* A newline ends a declaration, unless the line ends with `,`, `(`, `{` or a binary operator, or sits inside `()` or `[]`.

Keywords: `arc use lib req need limit part kind in let axis port shape place pose mate check out sheet view scale bom title artifact section prose table figure for on at via drive dir to from auto`.

## File structure

Every file starts with the version header, then its `use` lines, then one `req`, `part` or `artifact`.

```text
arc 0.1
use T1 = uploads/giao-trinh-ctm.pdf
use gbox = rec/gbox.arc
use standards = lib archee.standards
```

`use NAME = PATH` binds an upload, another `.arc` file, or a library (`lib archee.standards`).

## Requirements

A `req` holds what the job asks for.

```text
req gbox_req {
  need P: power = 7.5 kW
  need n_in: speed = 1450 rpm
  need Lh: time = 20000 h @T1 "Bảng 10.5"
  limit L_max: 480 mm <= 520 mm
}
```

`need` declares a typed value. `limit` declares a relation the design must hold.

## Parts

A part declares, in this order:

| Member  | Declares                                            |
| ------- | --------------------------------------------------- |
| `in`    | An input: `in T: torque`, optionally with a default |
| `let`   | A derived value: `let d2: length = d1 + 5 mm`       |
| `axis`  | A parallel axis: `axis a2 = (0 mm, a12) dir 0 deg`  |
| `port`  | A typed interface; see [Ports](/arc/parts#ports)    |
| `place` | A child part on an axis                             |
| `mate`  | A pairing of two ports                              |
| `check` | A relation that must hold: `check tau_ok: x <= tau` |
| `out`   | A value the parent can read                         |
| `sheet` | A drawing sheet; see [Sheets](/arc/sheets)          |

`arc fmt` puts members in this order and sorts dependencies inside each group.

## Variants

A variant is a base part with some `in` or `let` values replaced:

```text
part wheel3 : wheel2 { z = 72 }
```

A variant adds no members. Naming an undeclared field, or replacing one name twice in a chain, is an error, and a variant chain is one level deep.

## Canonical format

`arc fmt` produces one layout, so a file that differs from it reports `P03`.

* Header first, then `use` lines sorted by name, one blank line, then the body.
* One declaration per line, one space around `=` and binary operators, a unit separated by one space, `,` followed by one space.
* A citation comes last on its line. A comment sits on its own line above its declaration.
* A port stays on one line, so a line is one fact.
