diff --git a/doc/manual/souce/language/operators.md b/doc/manual/souce/language/operators.md index 80399c7..aa949b1 100644 --- a/doc/manual/souce/language/operators.md +++ b/doc/manual/souce/language/operators.md @@ -2,6 +2,37 @@ この章では、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 は未導入である。 + ## 優先順位 優先順位は高い順に以下である。 diff --git a/site/decodal-site/src/lib/docs.js b/site/decodal-site/src/lib/docs.js index 0f620f0..e2822b3 100644 --- a/site/decodal-site/src/lib/docs.js +++ b/site/decodal-site/src/lib/docs.js @@ -56,7 +56,7 @@ export const nav = [ ], }, { 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: 'Modules and Imports', slug: 'language/modules-and-imports' }, { title: 'Evaluation Semantics', slug: 'language/evaluation' }, diff --git a/site/decodal-site/src/style.css b/site/decodal-site/src/style.css index 5147fc2..d8b8ed8 100644 --- a/site/decodal-site/src/style.css +++ b/site/decodal-site/src/style.css @@ -194,6 +194,32 @@ main.playground { 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 { color: #93c5fd; font-weight: 700;