Enforce selector rules for match statements
- 主要語言
- Rust
- 星號
- 96
- 分支
- 39
- PR 合併指標
- 30 天內沒有已合併 PR
描述
[AirScript documentation](https://0xmiden.github.io/air-script/description/convenience.html) states the following constraints regarding selectors in match statements:
> AirScript makes the following assumptions about selector expressions, which are not yet enforced by the language:
> 1. All selector expressions are based on binary values. To enforce these, we must manually add constraints of the form x^2=x for all values involved in selector expressions.
> 2. All selector expressions are mutually exclusive. That is, for a given set of inputs, only one of the selector expressions in an enf > match statement can evaluate to 1, and all other selectors must evaluate to 0. Note: it is OK if all selector expressions evaluate to 0.
We should enforce it in the language: following PRs https://github.com/0xMiden/air-script/pull/413 and https://github.com/0xMiden/air-script/pull/423, we should be able to enforce that selectors are composed of binary expressions, and we could try all possible evaluations of the truth table to check by bruteforce it holds.
If the requirements do not hold, we should fail the compilation with an error message.
_Originally posted by @Leo-Besancon in https://github.com/0xMiden/air-script/issues/413#issuecomment-3108920310_
貢獻指南
研究方向
Review PRs #413 and #423 to understand the existing selector handling. The work involves modifying the compiler to enforce binary constraints (x^2=x) and mutual exclusivity via truth table brute-force. Start by examining the match statement parsing and constraint generation code. The outcome is a compilation error when requirements fail.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust
- 領域
- compilers
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100