r/ProgrammingLanguages • u/thecoommeenntt • Mar 08 '26
I’m building a programming language (Cx) would anyone be willing to check it out and give feedback?
Building a systems language called Cx looking for design feedback
Site: https://cx-lang.com · Repo: https://github.com/COMMENTERTHE9/Cx_lang
Cx is a systems language aimed at game engines and real-time simulation. Early stage tree-walk interpreter right now, compiler backend coming.
Core goals
- No GC, no runtime pauses
- Deterministic memory via arenas + handles
- Control without a borrow checker
What's working today
- Functions with typed params, implicit/explicit returns
- Numeric types
t8..t128,f64, strings with{name}interpolation - Arena allocator + free checker (double-free prevention)
Handle<T>registry with generation counters and stale detection- Parameter copy modes:
.copy,.copy.free,copy_into whenblocks with ranges, enums, and three-state bool (true/false/unknown)- Basic enums
Not done yet
- Loops, structs, arrays
- Modules, generics, stdlib
- Compiler backend
cx
fnc greet(name: str) {
print("hello {name}")
}
greet("Zara")
4
Upvotes
View all comments
Show parent comment
1
u/flatfinger Mar 13 '26
IMHO, the most practical way to make programs memory safe is often to establish a set of memory-safety invariants such that, following initialization, no function would be capable of passing control to another function when the invariants don't hold unless it received control when they don't hold or some outside thread broke them.
In K&R2 C, if a function like:
specifies as an invariant that at all places where it is invoked, the passed pointer
pmust identify anint32_t-aligned region of storage with space for at least4000bytes followingp, any of which may be set to any bit pattern without violating any other memory safety invariants, and adequate stack space is available when the function is called, the function would be incapable of violating any memory safety invariants unless one had already been violated somewhere.While program-language constructs to manage invariants may be helpful, what's IMHO more important is limiting set of operations that would be even capable of violating any of them, since functions that contain no such operations wouldn't need to be substantively examined (beyond observing the lack of possibly dangerous operations) to prove that a program is memory safe.
If, however, something like a signed integer multiply that is performed in some other part of the program could cause a compiler to bypass the
iftest above in circumstances wherexmight exceed 999, that will vastly increase the difficulty of memory safety analysis.