aboutsummaryrefslogtreecommitdiff
path: root/doc/language/cpsc-language-overview.7.md
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 15:11:38 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 15:21:14 +0000
commit64622b737f070b377fdef3fb31a67c084457bd7b (patch)
tree8111bfcf325ed9162dac645a0c68536bad954820 /doc/language/cpsc-language-overview.7.md
parentf14b50d776ec743bd62fda22a9c154bba9588840 (diff)
feat(codegen)!: require explicit REAL to INTEGER conversion and add INT
Implicit REAL to INTEGER is now a compile error with an INT(...) hint. INT is a compiler builtin that truncates toward zero and raises a runtime error for NaN or values outside the INTEGER range. No existing test program relied on the implicit conversion. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/language/cpsc-language-overview.7.md')
-rw-r--r--doc/language/cpsc-language-overview.7.md3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/language/cpsc-language-overview.7.md b/doc/language/cpsc-language-overview.7.md
index 05001bd..b1376d8 100644
--- a/doc/language/cpsc-language-overview.7.md
+++ b/doc/language/cpsc-language-overview.7.md
@@ -10,7 +10,7 @@ Keywords are uppercase and case-sensitive. Identifiers, including built-in funct
Assign with ASCII `<-`: `Count <- Count + 1`. Compare with `=`, `<>`, `<`, `>`, `<=`, and `>=`. Standard-library STRING comparisons compare contents, case-sensitively. Use `+`, `-`, `*`, and `/` for arithmetic; built-in `/` always returns REAL. Use `&` to join strings.
-User-defined types can overload operators with OVERLOAD FUNCTION OPERATOR; expressions then use the declared result type. See [cpsc-keyword-operator(7)](keyword/cpsc-keyword-operator.7.md). STRING cannot be implicitly converted to BOOLEAN. Typing is strict: arithmetic and unary minus accept only INTEGER and REAL, a comparison needs operands of the same type (or INTEGER with REAL), and BOOLEAN, CHAR and INTEGER never convert into one another implicitly (only INTEGER converts to REAL). Use ASC and CHR to move between CHAR and INTEGER.
+User-defined types can overload operators with OVERLOAD FUNCTION OPERATOR; expressions then use the declared result type. See [cpsc-keyword-operator(7)](keyword/cpsc-keyword-operator.7.md). STRING cannot be implicitly converted to BOOLEAN. Typing is strict: arithmetic and unary minus accept only INTEGER and REAL, a comparison needs operands of the same type (or INTEGER with REAL), and BOOLEAN, CHAR and INTEGER never convert into one another implicitly (only INTEGER converts to REAL). Use ASC and CHR to move between CHAR and INTEGER. REAL never converts to INTEGER implicitly; use INT.
Precedence, from highest to lowest: unary operators, `* / DIV MOD`, `+ - &`, comparisons, AND, OR. Parentheses override precedence.
@@ -83,6 +83,7 @@ These ordinary functions and the STRING class come from the embedded standard li
# BUILT-IN FUNCTIONS
- [cpsc-function-eof(7)](function/cpsc-function-eof.7.md): test for the end of a text file.
+- [cpsc-function-int(7)](function/cpsc-function-int.7.md): take the integer part of a number.
- [cpsc-function-malloc(7)](function/cpsc-function-malloc.7.md): allocate raw memory.
- [cpsc-function-realloc(7)](function/cpsc-function-realloc.7.md): resize an explicit allocation.
- [cpsc-function-free(7)](function/cpsc-function-free.7.md): release an explicit allocation.