aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-13 13:45:03 +0000
committer_ov4 <ov4@ov4.org>2026-10-13 13:45:03 +0000
commit05cdcb6a1cc3d4de3a0b3d12d4babcd6438b4754 (patch)
treed3e482d215d9d5feba8b40f9de15d6962f1e5bac /doc
parentf5a2541ed3faf9a942b867e2d54577352153afce (diff)
Add record-derived classes with explicit field visibility
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/cpsc.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/cpsc.md b/doc/cpsc.md
index fa4ae2b..8a57a63 100644
--- a/doc/cpsc.md
+++ b/doc/cpsc.md
@@ -66,6 +66,30 @@ Save IR and run it:
cpsc test.cps -r -o result.ir
```
+# CLASSES
+
+Declare classes at top level. Every field must explicitly specify `PUBLIC` or
+`PRIVATE`, without `DECLARE`:
+
+```text
+CLASS Person
+ PUBLIC Name : STRING
+ PRIVATE Age : INTEGER
+ENDCLASS
+
+DECLARE p : Person
+p.Name <- "Alice"
+OUTPUT p.Name
+```
+
+Classes use record value semantics: zero initialization, whole-value copying,
+arrays, pointers and ordinary function/procedure parameters. Private fields cannot
+be read, written or addressed externally; they are still initialized and copied
+with the whole value. Record `TYPE` fields remain implicitly public and cannot
+specify access levels. Class methods, constructors, destructors, `NEW` and
+`INHERITS` are not supported. Array fields remain unsupported in both records and
+classes.
+
# EXIT STATUS
**0**