Appendix C: Implementation Limits
This appendix documents implementation-defined limits of the Rue compiler. These limits are normative: a conforming implementation MUST support at least the minimum values specified here. Implementations MAY support larger values.
Programs that exceed these limits are not guaranteed to compile or execute correctly. A conforming implementation SHOULD produce a diagnostic when a limit is exceeded.
Numeric Limits
Integer literals MUST be representable as unsigned 64-bit integers during lexing. This limits literal values to the range 0 to 18446744073709551615 (2^64 - 1).
The following integer types have the specified ranges:
| Type | Minimum | Maximum |
|---|---|---|
i8 | -128 | 127 |
i16 | -32768 | 32767 |
i32 | -2147483648 | 2147483647 |
i64 | -9223372036854775808 | 9223372036854775807 |
u8 | 0 | 255 |
u16 | 0 | 65535 |
u32 | 0 | 4294967295 |
u64 | 0 | 18446744073709551615 |
Source File Limits
Source file size MUST be representable using 32-bit byte offsets. This limits source files to 4 GiB (4,294,967,295 bytes).
The span tracking system uses 32-bit unsigned integers for byte offsets, which determines this limit.
Array Limits
Array length MUST be representable as an unsigned 64-bit integer. This limits array sizes to 2^64 - 1 elements.
Practical limits on array size are determined by available memory and platform constraints rather than the type system.
Identifier Limits
There is no explicit limit on identifier length. Identifiers are stored as dynamically-allocated strings and are limited only by available memory.
Minimum Guaranteed Limits
A conforming implementation MUST support at least:
| Construct | Minimum Limit |
|---|---|
| Source file size | 4 GiB |
| Integer literal value | 2^64 - 1 |
| Array length | 2^64 - 1 |
| Function parameters | No fixed limit |
| Struct fields | No fixed limit |
| Enum variants | 2^64 |
| Nesting depth (blocks, loops, etc.) | No fixed limit |
"No fixed limit" means the construct is limited only by available memory, not by an explicit cap in the implementation.
Stack and Memory Considerations
While the language specification does not impose limits on recursion depth or stack usage, practical execution is constrained by:
- Operating system stack limits
- Available memory for local variables
- Platform-specific calling convention limits
Programs requiring deep recursion or large stack allocations SHOULD be designed with these platform constraints in mind.