summaryrefslogtreecommitdiff
path: root/chapter33/docs/33-grammar.md
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-11-23 16:45:54 -0800
committerCliff Click <cliffc@acm.org>2026-11-23 16:45:54 -0800
commitc7b2a8edc93a313728c59353dd7df5ff3abf26b7 (patch)
tree2ecb0ab0cb1a1aaa62d77b2e1b844dcac35f4365 /chapter33/docs/33-grammar.md
parent96f150b05516bc254c4035821c0119db1ecce301 (diff)
downloadSimple-c7b2a8edc93a313728c59353dd7df5ff3abf26b7.tar.gz
Simple-c7b2a8edc93a313728c59353dd7df5ff3abf26b7.zip
Next round auto-mem analysis done
Diffstat (limited to 'chapter33/docs/33-grammar.md')
-rw-r--r--chapter33/docs/33-grammar.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/chapter33/docs/33-grammar.md b/chapter33/docs/33-grammar.md
index 7e9ef8cd..a336d2f5 100644
--- a/chapter33/docs/33-grammar.md
+++ b/chapter33/docs/33-grammar.md
@@ -85,14 +85,16 @@ bindingModifier : '!' | '~' ;
initializer : assignment ;
// The prefix qualifies the named struct reference, not an enclosing array.
-// Each [] / [~] suffix qualifies its own array layer. ? requires a reference.
+// Each [] / [~] / [^] suffix qualifies its own array layer. ? requires a reference.
type
: functionType
| primitiveType typeSuffix*
| accessModifier? typeName typeSuffix*
;
accessModifier : '!' | '~' ;
-typeSuffix : '?' | '[]' | '[~]' ;
+typeSuffix : '?' | '[]' | '[~]' | '[^]' ;
+// [^] permits checked .del(); it is not a promise of uniqueness.
+// .del() uses ordinary member/call syntax. Runtime recycling is not implemented.
typeName : IDENTIFIER ('.' IDENTIFIER)* ;
primitiveType
@@ -187,9 +189,9 @@ argumentList : assignment (',' assignment)* ','? ;
// Allocation invokes the declared constructor; inline initializer blocks from
// earlier chapters are replaced by constructor arguments.
newExpression
- : 'new' type ('[' '~'? assignment ']' arrayInitializer? | arrayInitializer | callSuffix)?
+ : 'new' type ('[' ('~' | '^')? assignment ']' arrayInitializer? | arrayInitializer | callSuffix)?
;
-// With no explicit length, type must end in [] or [~] and the initializer is a list.
+// With no explicit length, type ends in [], [~], or [^]; the initializer is a list.
arrayInitializer
: '{' (assignment (',' assignment)* ','?)? '}'
| '{' ('int' | 'i32' | 'i64' | 'u32') IDENTIFIER '->' statement* '}'