docs / guide / The Cajeta Guide

Chapters — 6. Keywords
  1. Introduction
  2. 0. Introduction
  3. 1. Installation
  4. 2. Kick the tires
  5. 3. Your first project
  6. 4. Running your application
  7. 5. Debugging
  8. 6. Keywords
  9. 7. Comments
  10. 8. Native types
  11. 9. Type kinds
  12. 10. Allocation
  13. 11. Ownership & borrowing
  14. 12. Control flow
  15. 13. Strings & formatting
  16. 14. Templates & wildcards
  17. 15. Lambdas & captures
  18. 16. Operator overloading
  19. 17. Inheritance
  20. 18. Annotations & synthesis
  21. 19. DI & aspects
  22. 20. Error handling
  23. 21. Reflection
  24. 22. Differentiation
  25. 23. Code coverage
  26. 23. Profiling
  27. 24. Notebooks
  28. 25. Writing XPU Kernels

06 — Keywords

Every reserved word in Cajeta. The authoritative list is the lexer, antlr4/CajetaLexer.g4; this table matches it exactly. A reserved word cannot name a variable, method, or type, except where a note says it is contextual.

Two familiar words are missing on purpose:

  • There is no new. Construction names a storage class instead — heap Circle(2.0) or stack Circle(2.0). See chapter 10.
  • true, false, and null are literals, not keywords.

Primitive type names

Keywords
booleantruth value
char32-bit Unicode codepoint
int8 int16 int32 int64 int128signed integers
uint8 uint16 uint32 uint64 uint128unsigned integers
float16 float32 float64 float128IEEE-754 binary floats
float4e2m1 float6e2m3 float6e3m2 float8e4m3 float8e5m2 float8e4m3fnuz float8e5m2fnuzOCP microscaling floats, storage-only

Chapter 08 covers all of these. bfloat16 and pointer are also native types, but they are type names resolved like any other, not reserved words.

Declarations

Keywords
class interface enum record annotation viewtype kinds (chapter 09)
package importnamespacing
extends implementsinheritance
sealed non-sealed permitssealed hierarchies
voidno return value
varreserved for local type inference; parses but does not resolve yet
mutcontextual: record field mutation opt-in (chapter 09); an ordinary identifier everywhere else
structurereserved; no declaration syntax yet — using it is a parse error

Control flow

Keywords
if elsebranching
switch case default yieldselection and switch expressions
for do while break continueloops
returnmethod exit
try catch finally throw throwserror handling
assertassertions
gotoreserved, unused — no grammar rule accepts it

Objects and expressions

Keywords
this superreceiver and parent
instanceofruntime type test
operatoroperator-overload declarations

Memory and ownership

Keywords
heapheap construction: heap Foo(...)
stackstack construction: stack Foo(...)
sharedcontextual: workgroup-shared placement inside @Kernel bodies only; an ordinary identifier everywhere else

Structured concurrency

Keywords
asyncmethod modifier
await spawn detachtask expressions
scopeblock that joins all child tasks before exiting. Also accepted as an annotation attribute name, as in @Component(scope = "Request")

Modules (reserved)

pModule open requires exports opens to uses provides with transitive — reserved by the lexer for a future module system. The parser accepts every one of them as an ordinary identifier today, so methods named open or requires keep parsing. Note the placeholder spelling pModule.

Modifiers

Keywords
public protected privatevisibility
statictype-level member
finalno override / no reassignment
abstracta method with no body that descendants must implement, or a class that cannot be allocated
nativeimplemented by the runtime
constreserved; the grammar accepts it as a modifier
strictfp transient volatilegrammar-level modifiers, Java-familiar

Next: Comments.

Source: docs/guide/06-keywords.md · 3 min · 572 words