CASM Literals
CASM supports these literal forms:
| Form | Examples | Notes |
|---|---|---|
| Integer or decimal number | 0, -12, 3.5 | Decimal notation. A decimal point requires digits on both sides; scientific notation is not recognized. |
| Hexadecimal number | 0x2A, -0X10 | Requires at least one hexadecimal digit. |
| Boolean | true, false | Lowercase only. |
| Null | null | Lowercase only. |
| Character | 'x', '\n', '\'' | Exactly one Unicode character after escapes are decoded. |
| String | "hello", "line\n" | Used by instructions that accept a quoted string. |
Quoted forms recognize the escapes \\, \', \", \n, \r, \t, and \0. They cannot continue across a newline. Unknown escape sequences are rejected.
The load_const instruction accepts number, boolean, character, or null literals. Non-negative integer numbers from 0 through 255 are encoded as Byte values; other numbers are encoded as Number. Use str_new to construct a runtime String from a quoted literal.