|
2 | 2 |
|
3 | 3 | # Spar |
4 | 4 |
|
5 | | -<sup>Architecture analysis and design language toolchain</sup> |
| 5 | +<sup>AADL v2.2/v2.3 toolchain + deployment solver</sup> |
6 | 6 |
|
7 | 7 | |
8 | 8 |
|
|
11 | 11 |  |
12 | 12 |  |
13 | 13 |
|
| 14 | +[](https://github.com/pulseengine/spar/actions/workflows/ci.yml) |
| 15 | +[](https://codecov.io/gh/pulseengine/spar) |
| 16 | + |
14 | 17 | |
15 | 18 |
|
16 | 19 | <h6> |
|
31 | 34 |
|
32 | 35 | |
33 | 36 |
|
34 | | -Meld fuses. Loom weaves. Synth transpiles. Kiln fires. Sigil seals. **Spar structures.** |
35 | | - |
36 | | -A Rust implementation of a complete AADL (Architecture Analysis and Design Language) toolchain. Parses, validates, analyzes, transforms, and visualizes system architectures per SAE AS5506D. Designed for safety-critical systems modeling — vehicle software, avionics, WASM component architectures, and AI agent workflows. |
| 37 | +A Rust implementation of a complete AADL (Architecture Analysis and Design Language) toolchain. Parses, validates, analyzes, transforms, and visualizes system architectures per SAE AS5506D. Includes a deployment solver for automated thread-to-processor allocation. Designed for safety-critical systems modeling -- avionics, vehicle software, WASM component architectures, and AI agent workflows. |
37 | 38 |
|
38 | 39 | Spar replaces the Eclipse/Java-based OSATE2 toolchain with a fast, embeddable, WASM-compilable alternative built on rust-analyzer's proven architecture patterns. |
39 | 40 |
|
40 | | -## Quick Start |
| 41 | +## Installation |
41 | 42 |
|
42 | 43 | ```bash |
43 | | -# Clone and build |
44 | | -git clone https://github.com/pulseengine/spar |
45 | | -cd spar |
46 | | -cargo build |
47 | | - |
48 | | -# Parse an AADL model |
49 | | -./target/debug/spar parse vehicle.aadl |
| 44 | +# From source |
| 45 | +cargo install --git https://github.com/pulseengine/spar |
50 | 46 |
|
51 | | -# Validate a model |
52 | | -./target/debug/spar check vehicle.aadl |
| 47 | +# Or download a pre-built binary from releases |
| 48 | +# https://github.com/pulseengine/spar/releases |
53 | 49 | ``` |
54 | 50 |
|
55 | | -## Architecture |
| 51 | +## Quick Start |
56 | 52 |
|
57 | | -- **`crates/spar-parser/`** — Hand-written recursive descent parser with error recovery |
58 | | -- **`crates/spar-syntax/`** — Lossless concrete syntax tree (rowan red-green trees) |
59 | | -- **`crates/spar-cli/`** — Command-line interface |
| 53 | +```bash |
| 54 | +# Parse an AADL model and show the syntax tree |
| 55 | +spar parse vehicle.aadl --tree |
60 | 56 |
|
61 | | -### Planned |
| 57 | +# List all declared items |
| 58 | +spar items vehicle.aadl |
62 | 59 |
|
63 | | -- **`spar-hir`** — Semantic model with incremental computation (salsa) |
64 | | -- **`spar-analysis`** — Pluggable analyses (scheduling, latency, resource budgets, EMV2) |
65 | | -- **`spar-transform`** — Format transforms (AADL ↔ WIT, JSON, SVG) |
66 | | -- **`spar-mcp`** — Model Context Protocol server for AI agent integration |
67 | | -- **`spar-wasm`** — WebAssembly component for kiln deployment |
| 60 | +# Instantiate a system hierarchy |
| 61 | +spar instance --root Pkg::System.Impl vehicle.aadl platform.aadl |
68 | 62 |
|
69 | | -## Usage |
| 63 | +# Run all analysis passes |
| 64 | +spar analyze --root Pkg::System.Impl vehicle.aadl platform.aadl |
70 | 65 |
|
71 | | -```bash |
72 | | -# Parse and show syntax tree |
73 | | -spar parse model.aadl --tree |
| 66 | +# Allocate threads to processors (deployment solver) |
| 67 | +spar allocate --root Pkg::System.Impl vehicle.aadl platform.aadl |
74 | 68 |
|
75 | | -# Parse and show only errors |
76 | | -spar parse model.aadl --errors |
77 | | -``` |
| 69 | +# Render the architecture as SVG |
| 70 | +spar render --root Pkg::System.Impl -o arch.svg vehicle.aadl platform.aadl |
78 | 71 |
|
79 | | -## Building |
| 72 | +# Run verification assertions |
| 73 | +spar verify --root Pkg::System.Impl --rules rules.toml vehicle.aadl |
| 74 | +``` |
80 | 75 |
|
81 | | -```bash |
82 | | -# Build all crates |
83 | | -cargo build --workspace |
| 76 | +## CLI Commands |
| 77 | + |
| 78 | +| Command | Description | |
| 79 | +|------------|--------------------------------------------------------------| |
| 80 | +| `parse` | Parse AADL files and show syntax tree or errors | |
| 81 | +| `items` | List declared packages, types, implementations | |
| 82 | +| `instance` | Build the system instance hierarchy | |
| 83 | +| `analyze` | Run all analysis passes (SARIF/JSON/text output) | |
| 84 | +| `allocate` | Solve thread-to-processor deployment bindings | |
| 85 | +| `diff` | Compare two model versions for structural/diagnostic changes | |
| 86 | +| `modes` | List operational modes and mode transitions | |
| 87 | +| `render` | Generate SVG/HTML architecture diagrams | |
| 88 | +| `verify` | Evaluate verification assertions against the model | |
| 89 | +| `lsp` | Start the Language Server Protocol server | |
84 | 90 |
|
85 | | -# Run tests |
86 | | -cargo test --workspace |
87 | | -``` |
| 91 | +## Architecture |
88 | 92 |
|
89 | | -## Current Status |
| 93 | +12 crates, layered from low-level parsing to high-level analysis: |
90 | 94 |
|
91 | | -**Early Development** — AADL v2.2 parsing is the current focus. |
| 95 | +``` |
| 96 | +spar-syntax Lossless CST (rowan red-green trees) |
| 97 | +spar-parser Recursive descent parser with error recovery |
| 98 | +spar-annex AADL annex sublanguage parsing (EMV2, BLESS, BA) |
| 99 | +spar-base-db Salsa database for incremental computation |
| 100 | +spar-hir-def HIR definitions -- item tree, instance model, arenas |
| 101 | +spar-hir Public semantic facade (name resolution, properties) |
| 102 | +spar-analysis 27+ pluggable analysis passes |
| 103 | +spar-transform Format transforms (AADL <-> WIT, WAC, Rust crates, wRPC) |
| 104 | +spar-solver Deployment solver (thread-to-processor allocation) |
| 105 | +spar-render SVG architecture diagrams (compound Sugiyama layout) |
| 106 | +spar-cli Command-line interface |
| 107 | +spar-wasm WebAssembly component (WASI P2) |
| 108 | +``` |
92 | 109 |
|
93 | | -### Working |
| 110 | +## Key Features |
94 | 111 |
|
95 | | -- AADL lexer (all token types) |
96 | | -- Recursive descent parser with error recovery |
97 | | -- Lossless syntax tree (every byte preserved) |
98 | | -- CLI with parse command |
| 112 | +- **27+ analysis passes** -- scheduling, latency, connectivity, resource budgets, ARINC 653, EMV2 fault trees, bus bandwidth, weight/power, mode reachability, and more |
| 113 | +- **Assertion engine** -- declarative verification rules in TOML (`spar verify`) |
| 114 | +- **Deployment solver** -- automated thread-to-processor allocation with constraint satisfaction |
| 115 | +- **SARIF output** -- analysis results in SARIF format for CI integration |
| 116 | +- **VS Code extension** -- live AADL rendering and diagnostics via LSP |
| 117 | +- **WASM component** -- compiles to a 1.3 MB wasm32-wasip2 component |
| 118 | +- **Incremental** -- salsa-based memoization for fast re-analysis |
| 119 | +- **Lossless parsing** -- every byte preserved in the syntax tree |
99 | 120 |
|
100 | | -### In Progress |
| 121 | +## Documentation |
101 | 122 |
|
102 | | -- Complete AADL v2.2 grammar coverage |
103 | | -- Typed AST layer |
104 | | -- Semantic model (name resolution, property evaluation) |
| 123 | +- [Integration plan](docs/plans/2026-03-08-spar-rivet-integration.md) -- rivet lifecycle integration |
| 124 | +- [WASM-as-architecture design](docs/plans/2026-03-10-wasm-as-architecture-design.md) -- WIT/WAC/wRPC transforms |
| 125 | +- [VS Code extension design](docs/plans/2026-03-18-vscode-extension-design.md) -- editor integration |
| 126 | +- [Deployment solver plan](docs/plans/2026-03-21-deployment-solver-plan.md) -- allocation algorithm |
105 | 127 |
|
106 | | -## AADL |
| 128 | +## Safety |
107 | 129 |
|
108 | | -AADL (Architecture Analysis and Design Language) is an SAE aerospace standard (AS5506) for modeling real-time, safety-critical embedded systems. It describes software architecture, hardware platforms, and deployment bindings in a single analyzable notation. |
| 130 | +Full STPA (System-Theoretic Process Analysis) safety analysis: |
109 | 131 |
|
110 | | -Component categories: `system` · `process` · `thread` · `processor` · `memory` · `bus` · `device` · `data` · `subprogram` · and more. |
| 132 | +- [STPA analysis](safety/stpa/analysis.yaml) -- losses, hazards, UCAs, loss scenarios |
| 133 | +- [Safety requirements](safety/stpa/requirements.yaml) -- 23 STPA-derived requirements |
| 134 | +- [Rivet artifacts](artifacts/) -- requirements, architecture decisions, verification records |
111 | 135 |
|
112 | 136 | ## License |
113 | 137 |
|
114 | | -MIT License — see [LICENSE](LICENSE). |
| 138 | +MIT License -- see [LICENSE](LICENSE). |
115 | 139 |
|
116 | 140 | --- |
117 | 141 |
|
118 | 142 | <div align="center"> |
119 | 143 |
|
120 | | -<sub>Part of <a href="https://github.com/pulseengine">PulseEngine</a> — formally verified WebAssembly toolchain for safety-critical systems</sub> |
| 144 | +<sub>Part of <a href="https://github.com/pulseengine">PulseEngine</a> -- formally verified WebAssembly toolchain for safety-critical systems</sub> |
121 | 145 |
|
122 | 146 | </div> |
0 commit comments