cadl-lang 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cadl_lang-0.3.2/.gitignore +10 -0
- cadl_lang-0.3.2/CHANGELOG.md +166 -0
- cadl_lang-0.3.2/CITATION.cff +16 -0
- cadl_lang-0.3.2/LICENSE +21 -0
- cadl_lang-0.3.2/PKG-INFO +546 -0
- cadl_lang-0.3.2/README.md +510 -0
- cadl_lang-0.3.2/README_ja.md +510 -0
- cadl_lang-0.3.2/examples/a_sos_robot_delivery.cadl +192 -0
- cadl_lang-0.3.2/examples/c_sos_taxi_fleet.cadl +208 -0
- cadl_lang-0.3.2/examples/demo_codegen_targets.py +91 -0
- cadl_lang-0.3.2/examples/demo_robot_delivery.py +163 -0
- cadl_lang-0.3.2/examples/demo_sim_ir.py +567 -0
- cadl_lang-0.3.2/examples/demo_smart_city.py +136 -0
- cadl_lang-0.3.2/examples/household_chores.cadl +59 -0
- cadl_lang-0.3.2/examples/iot_data_sharing.cadl +127 -0
- cadl_lang-0.3.2/examples/raspimouse_c_sos.cadl +288 -0
- cadl_lang-0.3.2/examples/raspimouse_d_sos.cadl +150 -0
- cadl_lang-0.3.2/examples/raspimouse_mcp_sos.cadl +229 -0
- cadl_lang-0.3.2/examples/robot_delivery.cadl +102 -0
- cadl_lang-0.3.2/examples/smart_city_traffic.cadl +151 -0
- cadl_lang-0.3.2/examples/sos_dsl_robot_delivery.cadl +153 -0
- cadl_lang-0.3.2/examples/supply_chain.cadl +165 -0
- cadl_lang-0.3.2/examples/test_raspimouse.sh +70 -0
- cadl_lang-0.3.2/pyproject.toml +82 -0
- cadl_lang-0.3.2/src/cadl/__init__.py +3 -0
- cadl_lang-0.3.2/src/cadl/ai/__init__.py +18 -0
- cadl_lang-0.3.2/src/cadl/ai/llm_client.py +85 -0
- cadl_lang-0.3.2/src/cadl/ai/nl_to_cadl.py +147 -0
- cadl_lang-0.3.2/src/cadl/ai/prompts.py +336 -0
- cadl_lang-0.3.2/src/cadl/ast_nodes.py +504 -0
- cadl_lang-0.3.2/src/cadl/cli.py +625 -0
- cadl_lang-0.3.2/src/cadl/codegen/__init__.py +135 -0
- cadl_lang-0.3.2/src/cadl/codegen/actor_gen.py +80 -0
- cadl_lang-0.3.2/src/cadl/codegen/contract_gen.py +150 -0
- cadl_lang-0.3.2/src/cadl/codegen/emitter.py +141 -0
- cadl_lang-0.3.2/src/cadl/codegen/expr_compiler.py +210 -0
- cadl_lang-0.3.2/src/cadl/codegen/metric_gen.py +108 -0
- cadl_lang-0.3.2/src/cadl/codegen/opa/__init__.py +3 -0
- cadl_lang-0.3.2/src/cadl/codegen/opa/rego_expr.py +137 -0
- cadl_lang-0.3.2/src/cadl/codegen/opa/rego_gen.py +236 -0
- cadl_lang-0.3.2/src/cadl/codegen/protocol_gen.py +225 -0
- cadl_lang-0.3.2/src/cadl/codegen/runtime_gen.py +174 -0
- cadl_lang-0.3.2/src/cadl/codegen/runtime_support.py +331 -0
- cadl_lang-0.3.2/src/cadl/codegen/solidity/__init__.py +3 -0
- cadl_lang-0.3.2/src/cadl/codegen/solidity/solidity_expr.py +167 -0
- cadl_lang-0.3.2/src/cadl/codegen/solidity/solidity_gen.py +303 -0
- cadl_lang-0.3.2/src/cadl/codegen/transition_gen.py +112 -0
- cadl_lang-0.3.2/src/cadl/codegen/unity_csharp/__init__.py +133 -0
- cadl_lang-0.3.2/src/cadl/codegen/unity_csharp/contract_emitter.py +502 -0
- cadl_lang-0.3.2/src/cadl/codegen/unity_csharp/runtime_template.py +474 -0
- cadl_lang-0.3.2/src/cadl/deadlock.py +297 -0
- cadl_lang-0.3.2/src/cadl/grammar.lark +84 -0
- cadl_lang-0.3.2/src/cadl/iec62853.py +171 -0
- cadl_lang-0.3.2/src/cadl/parser.py +870 -0
- cadl_lang-0.3.2/src/cadl/regime_map.py +298 -0
- cadl_lang-0.3.2/src/cadl/sim/__init__.py +54 -0
- cadl_lang-0.3.2/src/cadl/sim/gen_go.py +141 -0
- cadl_lang-0.3.2/src/cadl/sim/gen_python.py +208 -0
- cadl_lang-0.3.2/src/cadl/sim/gen_unity.py +197 -0
- cadl_lang-0.3.2/src/cadl/sim/ir.py +253 -0
- cadl_lang-0.3.2/src/cadl/sim/lower.py +327 -0
- cadl_lang-0.3.2/src/cadl/sim/validate.py +131 -0
- cadl_lang-0.3.2/src/cadl/type_checker.py +339 -0
- cadl_lang-0.3.2/src/cadl/unparse.py +130 -0
- cadl_lang-0.3.2/src/cadl/verifier.py +763 -0
- cadl_lang-0.3.2/tests/__init__.py +0 -0
- cadl_lang-0.3.2/tests/test_ai.py +347 -0
- cadl_lang-0.3.2/tests/test_codegen.py +473 -0
- cadl_lang-0.3.2/tests/test_deadlock.py +301 -0
- cadl_lang-0.3.2/tests/test_examples_verify.py +30 -0
- cadl_lang-0.3.2/tests/test_expr_parser.py +159 -0
- cadl_lang-0.3.2/tests/test_iec62853.py +512 -0
- cadl_lang-0.3.2/tests/test_method_dispatch.py +98 -0
- cadl_lang-0.3.2/tests/test_name_resolution.py +83 -0
- cadl_lang-0.3.2/tests/test_opa_gen.py +604 -0
- cadl_lang-0.3.2/tests/test_parser.py +392 -0
- cadl_lang-0.3.2/tests/test_regime_map.py +452 -0
- cadl_lang-0.3.2/tests/test_runtime.py +227 -0
- cadl_lang-0.3.2/tests/test_sim_gen.py +267 -0
- cadl_lang-0.3.2/tests/test_sim_ir.py +294 -0
- cadl_lang-0.3.2/tests/test_sim_ir_sos_dsl.py +105 -0
- cadl_lang-0.3.2/tests/test_solidity_gen.py +693 -0
- cadl_lang-0.3.2/tests/test_sos_dsl_extension.py +141 -0
- cadl_lang-0.3.2/tests/test_type_checker.py +348 -0
- cadl_lang-0.3.2/tests/test_unity_csharp_codegen.py +217 -0
- cadl_lang-0.3.2/tests/test_unity_csharp_structural.py +148 -0
- cadl_lang-0.3.2/tests/test_unparse.py +43 -0
- cadl_lang-0.3.2/tests/test_verifier.py +482 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the CADL language and toolchain are documented in
|
|
4
|
+
this file. The format follows [Keep a Changelog](https://keepachangelog.com/)
|
|
5
|
+
and the project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.3.2] — 2026-10-09
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- Expression parser dropped the arithmetic operators, so every expression
|
|
13
|
+
containing `+`, `-`, `*` or `/` failed to parse and fell back to an opaque
|
|
14
|
+
string (reported as "not a valid expression").
|
|
15
|
+
- Expressions containing `AND` were returned as a raw parse tree instead of
|
|
16
|
+
an AST node, and `OR` bound tighter than `AND`. Precedence is now, loosest
|
|
17
|
+
to tightest: `OR`, `AND`, `NOT`, comparison, `+ -`, `* /`. A quantifier
|
|
18
|
+
scopes over everything to its right.
|
|
19
|
+
- Verifier encoded every name as a boolean coerced to 0/1, so thresholds
|
|
20
|
+
such as `battery > 20` were unsatisfiable. Names used in comparisons or
|
|
21
|
+
arithmetic are now real-valued; the same call text maps to the same symbol.
|
|
22
|
+
- Deadlock detector reported any request followed by its reply as a circular
|
|
23
|
+
dependency. Sequential steps are ordered and no longer count as waits;
|
|
24
|
+
only mutual sends between `parallel` branches do.
|
|
25
|
+
- `cadl verify` crashed when printing a `not_supported` result.
|
|
26
|
+
- Generated labels and simulator IR text showed AST class names
|
|
27
|
+
(`FunctionCall`, `ActorRef <= DurationLiteral`) or lost indices for parsed
|
|
28
|
+
expressions; they now show the CADL source text.
|
|
29
|
+
- Python codegen resolved a quantifier's bound variable through the actor
|
|
30
|
+
table (`ctx.actors['r']`).
|
|
31
|
+
- Generated Python and Solidity read every bare name from the actor table
|
|
32
|
+
(`ctx.actors['delivery_time']`, `actors_delivery_time`). Names that are not
|
|
33
|
+
declared actors are now state variables: `ctx.state['delivery_time']` in
|
|
34
|
+
Python, `stateUint["..."]` / `stateBool["..."]` in Solidity.
|
|
35
|
+
- Generated class and file names lower-cased the inside of camel-case names
|
|
36
|
+
(`Robotdeliverysystem.sol`); they now keep it (`RobotDeliverySystem.sol`).
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- "Assumes do not entail guarantees" is reported as `[INFO]`, not `[FAIL]`:
|
|
40
|
+
guarantees are obligations, not consequences of the assumptions. `verify`
|
|
41
|
+
instead fails a contract whose assumptions contradict each other
|
|
42
|
+
(`Contract '<id>' assumptions`), per the spec's `all_assumes_satisfiable`.
|
|
43
|
+
- `[INFO]` and `[SKIP]` results are excluded from the pass/fail totals.
|
|
44
|
+
- Examples: transitions leaving the same regime now have mutually exclusive
|
|
45
|
+
conditions (`a_sos_robot_delivery`, `c_sos_taxi_fleet`,
|
|
46
|
+
`smart_city_traffic`, `supply_chain`, `raspimouse_mcp_sos`); the MCP
|
|
47
|
+
example uses `for all` / `exists` in place of `all(...)` / `any(...)`.
|
|
48
|
+
Every example now passes `cadl verify`, and CI enforces it.
|
|
49
|
+
|
|
50
|
+
- **Generated names changed**: the runtime class and the Solidity
|
|
51
|
+
orchestrator of an SoS with a camel-case name are now spelled as in the
|
|
52
|
+
source, e.g. `RobotDeliverySystemRuntime` (was `RobotdeliverysystemRuntime`).
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
- Member access on an indexed actor: `ROBOT[i].battery`, `ROBOT[*].status`.
|
|
56
|
+
- Aggregate comprehensions as call arguments:
|
|
57
|
+
`sum(ROBOT[i].goal_count for i in 1..5)`, `sum(r.load for r in ROBOT[*])`.
|
|
58
|
+
- `cadl.unparse.expr_to_source()` renders an expression back to CADL text.
|
|
59
|
+
- `CONTRIBUTING.md`, `SECURITY.md` and `CITATION.cff`.
|
|
60
|
+
|
|
61
|
+
## [0.3.1] — 2026-10-09
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
- PyPI distribution renamed from `cadl` to `cadl-lang` (the name `cadl` is
|
|
65
|
+
taken on PyPI by an unrelated project). The import package (`import cadl`)
|
|
66
|
+
and the `cadl` CLI command are unchanged.
|
|
67
|
+
- The package version is now read from `cadl.__version__` only
|
|
68
|
+
(`pyproject.toml` no longer carries a second copy).
|
|
69
|
+
- CI runs on Python 3.13 as well, and smoke-tests parse / check /
|
|
70
|
+
sim-validate / codegen / sim-gen on every example instead of three.
|
|
71
|
+
- README: installation from PyPI, feature status table in place of the
|
|
72
|
+
development-phase roadmap, updated hands-on links.
|
|
73
|
+
|
|
74
|
+
### Fixed
|
|
75
|
+
- Unity C# codegen emitted `break` instead of `return` in transition guards.
|
|
76
|
+
- `scripts/sos_dsl_handson_e2e.sh` recovers from a nested
|
|
77
|
+
`Generated/` / `Runtime/` directory left by an earlier run.
|
|
78
|
+
- Solidity generator tests expected file names in a different letter case
|
|
79
|
+
from what the generator writes, so they failed on case-sensitive file
|
|
80
|
+
systems (CI on Linux).
|
|
81
|
+
|
|
82
|
+
## [0.3.0] — 2026-04-28
|
|
83
|
+
|
|
84
|
+
### Added
|
|
85
|
+
- SoS-DSL extension (spec Appendix E): `lifecycle:` and `monitors:` blocks
|
|
86
|
+
in the parser, carried through to the simulator IR.
|
|
87
|
+
- Unity C# code generation target for the SoS-DSL extension, with an
|
|
88
|
+
end-to-end script (`scripts/sos_dsl_handson_e2e.sh`) and structural lint
|
|
89
|
+
tests for the generated C#.
|
|
90
|
+
- FCFS task arbitration and motivation config in the simulator IR and the
|
|
91
|
+
Unity config generator.
|
|
92
|
+
- `VerificationSpec.method` / `expr` / `bound` fields and
|
|
93
|
+
`cadl.verifier.dispatch_spec()` implementing explicit `not_supported`
|
|
94
|
+
results for `model_check` / `simulation` / `proof` methods per
|
|
95
|
+
Appendix A §A.8 (previously these were silently skipped).
|
|
96
|
+
- Optional `MotivationBlock` / `AgentMotivationBlock` /
|
|
97
|
+
`GovernanceMotivationBlock` AST nodes and `SoSDefinition.motivation`
|
|
98
|
+
field for CADL Appendix C (v0.1-ext) motivation extension parity with
|
|
99
|
+
`cadl-explorer`.
|
|
100
|
+
- `LICENSE` (MIT) and full packaging metadata in `pyproject.toml`.
|
|
101
|
+
- GitHub Actions workflow running `pytest` on Python 3.9–3.12 and building
|
|
102
|
+
the sdist + wheel on every push.
|
|
103
|
+
- `CHANGELOG.md` (this file).
|
|
104
|
+
- Hands-on section in the README pointing to the `cadl-spec` materials.
|
|
105
|
+
|
|
106
|
+
### Changed
|
|
107
|
+
- Fixed attribution in `README.md` / `README_ja.md` from "Matsubara
|
|
108
|
+
Laboratory" / "松原研究室" to "ERTL".
|
|
109
|
+
- `CodegenSpec.target` docstring updated to enumerate the canonical
|
|
110
|
+
target catalog (`unity` / `ros2` / `python` / `solidity` / `opa` /
|
|
111
|
+
user identifier) to match Appendix D of the spec.
|
|
112
|
+
|
|
113
|
+
### Fixed
|
|
114
|
+
- Unity C# `PredicateEvaluator` emitted an invalid regex literal.
|
|
115
|
+
|
|
116
|
+
## [0.2.2] — 2026-03-23
|
|
117
|
+
|
|
118
|
+
### Fixed
|
|
119
|
+
- Cyrillic characters in identifiers in `examples/raspimouse_c_sos.cadl`.
|
|
120
|
+
|
|
121
|
+
## [0.2.1] — 2026-03-22
|
|
122
|
+
|
|
123
|
+
### Changed
|
|
124
|
+
- README updated with the Raspimouse examples.
|
|
125
|
+
|
|
126
|
+
## [0.2.0] — 2026-03-22
|
|
127
|
+
|
|
128
|
+
### Added
|
|
129
|
+
- Regime transition analysis and regime map (`regime_map.py`,
|
|
130
|
+
`cadl regime-map`).
|
|
131
|
+
- Multi-target code generation: Solidity smart contracts
|
|
132
|
+
(`codegen/solidity/`) and OPA / Rego policies (`codegen/opa/`) next to
|
|
133
|
+
the Python runtime (`cadl codegen --target`).
|
|
134
|
+
- IEC 62853 report (`iec62853.py`, `cadl iec62853`).
|
|
135
|
+
- Three-layer simulator IR (Institution / Protocol / Algorithm) and config
|
|
136
|
+
generators for Python, Unity and Go simulators (`cadl/sim/`).
|
|
137
|
+
- Examples: supply chain, smart city traffic, A-SoS robot delivery, C-SoS
|
|
138
|
+
taxi fleet, three Raspimouse swarm modes, and demo scripts including an
|
|
139
|
+
A-SoS vs C-SoS governance comparison.
|
|
140
|
+
|
|
141
|
+
### Fixed
|
|
142
|
+
- String values in `environment:` were parsed as expressions.
|
|
143
|
+
|
|
144
|
+
## [0.1.0] — 2026-03-17
|
|
145
|
+
|
|
146
|
+
Initial draft of the CADL compiler (not tagged).
|
|
147
|
+
|
|
148
|
+
### Added
|
|
149
|
+
- Lark grammar (`src/cadl/grammar.lark`) and parser producing an AST.
|
|
150
|
+
- Type checker and deadlock analyzer (`type_checker.py`, `deadlock.py`).
|
|
151
|
+
- Verifier integrating Z3 for properties declared in `verification:`
|
|
152
|
+
blocks.
|
|
153
|
+
- Python runtime code generation (actor / contract / metric / protocol /
|
|
154
|
+
transition scaffolds).
|
|
155
|
+
- AI-assisted natural-language → CADL translation (`ai/`), gated behind
|
|
156
|
+
the optional `ai` extra (requires `anthropic`).
|
|
157
|
+
- CLI entry point `cadl`.
|
|
158
|
+
- Example CADL files under `examples/` and a pytest suite.
|
|
159
|
+
|
|
160
|
+
[Unreleased]: https://github.com/ertlnagoya/cadl/compare/v0.3.2...HEAD
|
|
161
|
+
[0.3.2]: https://github.com/ertlnagoya/cadl/compare/v0.3.1...v0.3.2
|
|
162
|
+
[0.3.1]: https://github.com/ertlnagoya/cadl/compare/v0.3.0...v0.3.1
|
|
163
|
+
[0.3.0]: https://github.com/ertlnagoya/cadl/compare/v0.2.2...v0.3.0
|
|
164
|
+
[0.2.2]: https://github.com/ertlnagoya/cadl/compare/v0.2.1...v0.2.2
|
|
165
|
+
[0.2.1]: https://github.com/ertlnagoya/cadl/compare/v0.2.0...v0.2.1
|
|
166
|
+
[0.2.0]: https://github.com/ertlnagoya/cadl/releases/tag/v0.2.0
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use CADL in your research, please cite it as below."
|
|
3
|
+
title: "CADL: Contract Architecture Description Language"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- name: "ERTL, Graduate School of Informatics, Nagoya University"
|
|
7
|
+
version: 0.3.2
|
|
8
|
+
date-released: 2026-10-09
|
|
9
|
+
license: MIT
|
|
10
|
+
repository-code: "https://github.com/ertlnagoya/cadl"
|
|
11
|
+
url: "https://ertlnagoya.github.io/cadl-spec/"
|
|
12
|
+
keywords:
|
|
13
|
+
- system-of-systems
|
|
14
|
+
- governance
|
|
15
|
+
- formal-verification
|
|
16
|
+
- domain-specific-language
|
cadl_lang-0.3.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ERTL, Graduate School of Informatics, Nagoya University
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|