Enforce selector rules for match statements
- Vorherrschende Sprache
- Rust
- Sterne
- 96
- Forks
- 39
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
[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_
Beitragsleitfaden
Rechercherichtung
Überprüfe die PRs #413 und #423, um die bestehende Selektoren-Behandlung zu verstehen. Die Arbeit umfasst die Änderung des Compilers, um binäre Constraints (x^2=x) und gegenseitige Ausschließlichkeit mittels Brute-Force-Wahrheitstabellen durchzusetzen. Beginne mit der Untersuchung des Codes für die Parsing von Match-Anweisungen und die Constraint-Generierung. Das Ergebnis ist ein Kompilierungsfehler, wenn die Anforderungen nicht erfüllt sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100