From f2e9c9afe1508c070967f3e892f42e1e379142c1 Mon Sep 17 00:00:00 2001 From: Alex Hirsch Date: Tue, 13 Apr 2021 15:24:42 +0200 Subject: [PATCH] Enumerate operator type support --- specification.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/specification.md b/specification.md index 5849b74..eaa01df 100644 --- a/specification.md +++ b/specification.md @@ -149,13 +149,23 @@ String literals are at most 1000 characters long. Arrays are at most `LONG_MAX` elements long. +### Operators + +The following table enumerates which types an operator supports. +In the case of a binary operator, both sides must be of the same type. + +| Operator | Supported Types | +| ----------------- | ---------------------- | +| `-` `+` `*` `/` | `int`, `float` | +| `<` `<=` `>` `>=` | `int`, `float` | +| `==` `!=` | `bool`, `int`, `float` | +| `!` `&&` `||` | `bool` | + ### Special Semantics #### Boolean `bool` is considered a first-class citizen, distinct from `int`. - -The operators `!`, `&&`, and `||` can only be used with Booleans. Short-circuit evaluation is *not* supported. An expression used as a condition (for `if` or `while`) is expected to be of type `bool`.