mirror of
https://github.com/NixOS/nix.git
synced 2025-12-09 18:41:03 +01:00
doc: Precedence aligns with disjunctive normal form
This commit is contained in:
parent
1039b6719b
commit
97a60c1fab
1 changed files with 9 additions and 2 deletions
|
|
@ -23,8 +23,8 @@
|
||||||
| [Greater than or equal to][Comparison] | *expr* `>=` *expr* | none | 10 |
|
| [Greater than or equal to][Comparison] | *expr* `>=` *expr* | none | 10 |
|
||||||
| [Equality] | *expr* `==` *expr* | none | 11 |
|
| [Equality] | *expr* `==` *expr* | none | 11 |
|
||||||
| Inequality | *expr* `!=` *expr* | none | 11 |
|
| Inequality | *expr* `!=` *expr* | none | 11 |
|
||||||
| [Logical conjunction] (`AND`) | *bool* `&&` *bool* | left | 12 |
|
| [Logical conjunction] (`AND`) | *bool* `&&` *bool* | left | [12](#precedence-and-disjunctive-normal-form) |
|
||||||
| [Logical disjunction] (`OR`) | *bool* <code>\|\|</code> *bool* | left | 13 |
|
| [Logical disjunction] (`OR`) | *bool* <code>\|\|</code> *bool* | left | [13](#precedence-and-disjunctive-normal-form) |
|
||||||
| [Logical implication] | *bool* `->` *bool* | right | 14 |
|
| [Logical implication] | *bool* `->` *bool* | right | 14 |
|
||||||
| [Pipe operator] (experimental) | *expr* `\|>` *func* | left | 15 |
|
| [Pipe operator] (experimental) | *expr* `\|>` *func* | left | 15 |
|
||||||
| [Pipe operator] (experimental) | *func* `<\|` *expr* | right | 15 |
|
| [Pipe operator] (experimental) | *func* `<\|` *expr* | right | 15 |
|
||||||
|
|
@ -251,6 +251,13 @@ This operator is [strict](@docroot@/language/evaluation.md#strictness) in *bool1
|
||||||
|
|
||||||
[Logical disjunction]: #logical-disjunction
|
[Logical disjunction]: #logical-disjunction
|
||||||
|
|
||||||
|
### Precedence and disjunctive normal form
|
||||||
|
|
||||||
|
The precedence of `&&` and `||` aligns with disjunctive normal form.
|
||||||
|
Without parentheses, an expression describes multiple "permissible situations" (connected by `||`), where each situation consists of multiple simultaneous conditions (connected by `&&`).
|
||||||
|
|
||||||
|
For example, `A || B && C || D && E` is parsed as `A || (B && C) || (D && E)`, describing three permissible situations: A holds, or both B and C hold, or both D and E hold.
|
||||||
|
|
||||||
## Logical implication
|
## Logical implication
|
||||||
|
|
||||||
> **Syntax**
|
> **Syntax**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue