A hobbyist built pslang, a low-level statically-typed language, to solve ECS-friendly, sandboxable modding for a simulation-heavy game.
Key Takeaways
pslang targets seamless C interop, indentation-based scoping, and first-class fixed-size arrays – designed to iterate over raw ECS component pointers without per-entity FFI overhead.
Lua was rejected for modding due to unreliable sandboxing (requires manually deleting stdlib IO functions) and poor C-pointer semantics; native C++/Rust rejected because bundling a compiler or loading DLLs makes sandboxing impossible.
The type system covers 13 primitives: i8-i64, u8-u64, f16-f32-f64, bool, and unit; all integer arithmetic is two’s-complement with no UB.
Function types use clean a -> b syntax instead of C function-pointer notation; arrays are value types passable and returnable by value, unlike C/C++.
A working 1k LOC Monte-Carlo path tracer written in pslang serves as the primary real-world validation.
Hacker News Comment Review
Strong consensus: skip lex/yacc/ANTLR entirely – a hand-written recursive descent parser with Pratt parsing covers most languages in a weekend, and is faster and easier to extend.
Commenters with shipped hobby languages (Scheme-based game scripting, Ruby-inspired Sapphire, Turing machine compiler toolchain) confirm the on-ramp is low but long-term polish is the real cost.
The core tension the thread surfaces: copying existing PL ideas is tractable; novel semantics that survive real-world testing is where difficulty compounds.
Notable Comments
@sieve: “The lexer/parser is never the bottleneck” – argues LLMs now reduce parser bootstrap to ~15 minutes from a clean spec.