Document operator reference
This commit is contained in:
parent
2fe54bda62
commit
9e728fb634
|
|
@ -2,6 +2,37 @@
|
||||||
|
|
||||||
この章では、Decodal の演算子の意味を定義する。
|
この章では、Decodal の演算子の意味を定義する。
|
||||||
|
|
||||||
|
## 演算子一覧
|
||||||
|
|
||||||
|
| 演算子 | 形 | 種類 | 対象 | 結果 / 意味 |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| `.` | `object.field` | field reference | object / abstract object | field value |
|
||||||
|
| call | `fn(arg)` | function call | function | function result |
|
||||||
|
| `!` | `!expr` | unary logical | concrete `Bool` | concrete `Bool` |
|
||||||
|
| `-` | `-expr` | unary arithmetic | concrete `Int` / `Float` | negated number |
|
||||||
|
| `*` | `lhs * rhs` | arithmetic | concrete `Int` / `Float` | numeric product |
|
||||||
|
| `/` | `lhs / rhs` | arithmetic | concrete `Int` / `Float` | `Float` quotient |
|
||||||
|
| `+` | `lhs + rhs` | arithmetic | concrete `Int` / `Float` | numeric sum |
|
||||||
|
| `-` | `lhs - rhs` | arithmetic | concrete `Int` / `Float` | numeric difference |
|
||||||
|
| `==` | `lhs == rhs` | equality | concrete scalar | concrete `Bool` |
|
||||||
|
| `!=` | `lhs != rhs` | equality | concrete scalar | concrete `Bool` |
|
||||||
|
| `<` | `lhs < rhs` | ordering | concrete `Int` / `Float` | concrete `Bool` |
|
||||||
|
| `<=` | `lhs <= rhs` | ordering | concrete `Int` / `Float` | concrete `Bool` |
|
||||||
|
| `>` | `lhs > rhs` | ordering | concrete `Int` / `Float` | concrete `Bool` |
|
||||||
|
| `>=` | `lhs >= rhs` | ordering | concrete `Int` / `Float` | concrete `Bool` |
|
||||||
|
| `>` | `> value` | comparison constraint | numeric constraint value | abstract constraint |
|
||||||
|
| `>=` | `>= value` | comparison constraint | numeric constraint value | abstract constraint |
|
||||||
|
| `<` | `< value` | comparison constraint | numeric constraint value | abstract constraint |
|
||||||
|
| `<=` | `<= value` | comparison constraint | numeric constraint value | abstract constraint |
|
||||||
|
| `&&` | `lhs && rhs` | logical | concrete `Bool` | short-circuit AND |
|
||||||
|
| `||` | `lhs || rhs` | logical | concrete `Bool` | short-circuit OR |
|
||||||
|
| `&` | `lhs & rhs` | composition | value / constraint / object | constraint-preserving composition |
|
||||||
|
| `//` | `lhs // rhs` | patch | object / value | right-biased structural patch |
|
||||||
|
| `default` | `base default fallback` | default | abstract value | materialization fallback |
|
||||||
|
|
||||||
|
`concrete scalar` は `String`、`Bool`、`Int`、`Float` を指す。
|
||||||
|
`++` による array concat は未導入である。
|
||||||
|
|
||||||
## 優先順位
|
## 優先順位
|
||||||
|
|
||||||
優先順位は高い順に以下である。
|
優先順位は高い順に以下である。
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export const nav = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ title: 'Constraints and Defaults', slug: 'language/constraints-and-defaults' },
|
{ title: 'Constraints and Defaults', slug: 'language/constraints-and-defaults' },
|
||||||
{ title: 'Composition Operators', slug: 'language/operators' },
|
{ title: 'Operators', slug: 'language/operators' },
|
||||||
{ title: 'Functions', slug: 'language/functions' },
|
{ title: 'Functions', slug: 'language/functions' },
|
||||||
{ title: 'Modules and Imports', slug: 'language/modules-and-imports' },
|
{ title: 'Modules and Imports', slug: 'language/modules-and-imports' },
|
||||||
{ title: 'Evaluation Semantics', slug: 'language/evaluation' },
|
{ title: 'Evaluation Semantics', slug: 'language/evaluation' },
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,32 @@ main.playground {
|
||||||
padding: 1px 4px;
|
padding: 1px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdown table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
display: block;
|
||||||
|
margin: 20px 0;
|
||||||
|
overflow-x: auto;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.markdown th,
|
||||||
|
.markdown td {
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 8px 10px;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.markdown th {
|
||||||
|
background: var(--inline-code-bg);
|
||||||
|
color: var(--heading);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.markdown tr:nth-child(even) td {
|
||||||
|
background: color-mix(in srgb, var(--surface) 92%, var(--border));
|
||||||
|
}
|
||||||
|
|
||||||
.tok-keyword {
|
.tok-keyword {
|
||||||
color: #93c5fd;
|
color: #93c5fd;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user