[ABNF] Add rule for binary expressions.

This does not change the language. It just adds a rule to name binary
expressions explicitly. This makes the relation with ternary expressions
clearer, and as usual it explicates more terminology.
This commit is contained in:
Alessandro Coglio 2022-04-14 22:26:25 -07:00
parent cd8ac3b8d2
commit 7691e35d86
2 changed files with 18 additions and 7 deletions

View File

@ -148,6 +148,7 @@ keyword = %s"address"
/ %s"char"
/ %s"console"
/ %s"const"
/ %s"constant"
/ %s"else"
/ %s"field"
/ %s"for"
@ -637,13 +638,21 @@ disjunctive-expression = conjunctive-expression
Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [disjunctive-expression](#user-content-disjunctive-expression)_;
<a name="conditional-expression"></a>
<a name="binary-expression"></a>
```abnf
conditional-expression = disjunctive-expression
/ disjunctive-expression "?" expression ":" expression
binary-expression = disjunctive-expression
```
Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [expression](#user-content-expression)_;
Go to: _[disjunctive-expression](#user-content-disjunctive-expression)_;
<a name="conditional-expression"></a>
```abnf
conditional-expression = binary-expression
/ binary-expression "?" expression ":" expression
```
Go to: _[binary-expression](#user-content-binary-expression), [expression](#user-content-expression)_;
<a name="expression"></a>
@ -805,7 +814,7 @@ Go to: _[function-parameter](#user-content-function-parameter)_;
<a name="function-parameter"></a>
```abnf
function-parameter = [ %s"public" / %s"const" ] identifier ":" type
function-parameter = [ %s"public" / %s"constant" / %s"const" ] identifier ":" type
```
Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_;

View File

@ -265,8 +265,10 @@ conjunctive-expression = equality-expression
disjunctive-expression = conjunctive-expression
/ disjunctive-expression "||" conjunctive-expression
conditional-expression = disjunctive-expression
/ disjunctive-expression "?" expression ":" expression
binary-expression = disjunctive-expression
conditional-expression = binary-expression
/ binary-expression "?" expression ":" expression
expression = conditional-expression