How arche-lang maps to Arche
Arche is the visual modelling tool that arche-lang compiles to. archec build
turns your .arche files into an Arche project: a folder of YAML files that
Arche opens. This page says what each declaration becomes in that folder.
A first build#
Save this as main.arche:
message PING "Ping" { field seq: uint8 }
component Sensor "Sensor" {
out data: data sends PING
}
component Logger "Logger" {
in data: data receives PING
}
system Bench "Bench" {
part sensor: Sensor
part logger: Logger
sensor.data -> logger.data
}Build it:
archec build main.arche
✓ 9 files → arche-out (bench.yaml, models.yaml, templates.yaml, messages.yaml, types.yaml, colors.yaml, simulation.yaml, menu.yaml, layout.yaml)
open with: arche --project /path/to/arche-out
The system Bench became the model file bench.yaml. It holds the two parts
as components, with their ports, and the link between them:
components:
- id: sensor
template: box
name: Sensor
ports:
- id: data
type: data
direction: out
messages:
- PING
…
links:
- id: sensor-data-logger-data
from: sensor.data
to: logger.data
The components Sensor and Logger became templates in templates.yaml, and
the message went to messages.yaml.
What each declaration becomes#
| arche-lang | Arche project |
|---|---|
system X { … } |
x.yaml model file (listed in models.yaml); its children are the canvas's root components |
top-level component D |
a template in templates.yaml, copied into every part x: D (instance values override, lists merge by id) |
port, fn, var, memory, states, nested requirement |
ports, functions, variables, memory, stateMachine, requirements on the component |
a.p -> b.q { carries M; latency 1ms } |
links with icd.messages and timing |
canvas X { part at x, y; part size w, h } (or at on a part) |
each component's position and size |
purpose "…" |
the component's mainFunctions |
message, type/enum/struct, const |
messages.yaml, data-types.yaml, variables.yaml |
requirement, actor, mission |
requirements.yaml, actors.yaml, missions.yaml |
satisfies, verifies, derives, allocated-to, trace … |
traces.yaml, with Arche element addresses (car.yaml#adcu:fn/plan) |
test-plan, scenario, simulation |
testplans.yaml, scenarios.yaml, simulation.yaml |
cores N, core id, os, ram, isa, freq on a component |
nature: hardware, cores: [{id, name, type}], hardware: {os, ram, …}. The component becomes a target that threads run on. |
deployment → binary … on cpu → process → thread / isr |
processes.yaml and threads.yaml (tasks.yaml on an RTOS or bare-metal processor). Every part that a thread runs gets thread:. |
thread period + step fn |
an rt.timer beside the part. It ticks a tick-<thread> port, which calls fn. |
route a.p -> b.q over bus { priority 3 } |
the link's timing.bus and priority, and the bus bitrate. In simulation the bus is a shared medium. |
port / link buffer queue + depth N + overflow, buffer sample |
link timing.queue / drop. A sample is a queue of one that keeps the newest value. |
kind, layer, tag, color, port-type |
kinds.yaml, layers.yaml, tags.yaml/tag-types.yaml, colors.yaml, types.yaml. Entries you use without declaring them are added for you. |
package p { … } |
nothing of its own. Names are qualified in the source (p.X); ids stay global in Arche. |
interface I { messages …; fn op() }, port provides I / requires I |
a port type in types.yaml, with messages, operations and extends; the ports' provides / requires |
part w: Wheel[4], component D(n: int32 = 8) |
four components w_0 … w_3; each instance's parameter values as variables |
parameter, variant (+ variants a, b), study, viewpoint |
parameters.yaml, variants.yaml (+ variants: on components and links), studies.yaml, viewpoints.yaml |
budget power 150W |
an Arche budget: a variable with rollup: sum (or max), with the draws as same-named variables beneath it |
hazard, safety-goal |
safety.yaml (hazards, safetyGoals). failure-mode and gate are checked and typeset, but not written. |
decision |
a requirement of category decision, with derives / satisfies traces |
process … { lanes …; a: act; a -> b : x } |
a scenario with one sequence |
equation der(x) = …, solver 1ms |
the component's equations and solver. Arche's simulator integrates them (RK4). |
raw "file.yaml" ```yaml …``` |
that file, as it is. Use it for anything the language does not model yet. |
Checks on every build#
Every build validates the generated YAML against
schemas/arche-project.schema.json before it writes anything.
The car example and the patterns example both load in Arche with 0 errors
from Arche's own checker (arche-cli check). Their test plans pass in Arche's
simulator (arche-cli test): 3/3 for the car, 1/1 for the patterns.
Behaviour bodies#
Arche runs behaviour as Python. A body can be written in two ways:
A
```archebody is checked by archec. It is written into the project as the Python it means:arche-lang Python wait 10msawait wait(ms(10))send p MSG { … }send(self.p, MSG(...))f()await self.f()goto Stateawait goto("State")A
```pythonbody is written as it is. The linter checks only the parts it can see from the model: calls to functions that have no body, and a missingawait.