Limitations and runtime checks
Runtime checks
These situations stop the program with panic: ... on stderr and exit code 101:
- array index out of bounds
popon an empty array- integer division or remainder by zero
substrwith an invalid range,str_atout of range,char_stroutside 0..255- running out of memory
- an explicit
panic(msg)
i32 overflow wraps around (the C compiler is invoked with -fwrapv). If you compile the output of fenneth emit yourself, add -fwrapv to keep the same behaviour.
Known limitations
- Memory is never freed (no GC and no
free). Strings produced by+,substrand arrays only grow. That is fine for short-lived programs such as compilers and tools, but not for long-running processes. - Evaluation order of operands and call arguments follows C and is unspecified. Avoid expressions such as
f() + g()that depend on the order of side effects. - Globals can only be initialised with literal values.
- Missing features: enums, generics, closures, hash maps, and
</>onString. - No shadowing: a variable name cannot be re-declared while it is visible from an outer scope, including globals.
- Return on every path: a function with a return type must
returnon all paths.panic()andexit()do not count. - Error reporting: the compiler stops at the first lexer or parser error; type checker errors are reported together.
- Strings are bytes: lengths and indices count bytes, not Unicode characters.
mainmust befn main() -> i32with no parameters.