Nucleus is a new systems programming language. I initially conceived of it as "a replacement for C" adding syntactic abstraction with Lisp-style structural macros, but it has grown beyond that concept. It still aims to be a drop-in replacement for C with full ABI compatibility and no mandatory runtime overhead, but it adds modern capabilities:
- Guaranteed non-null reference types
- Maybe/match semantics for nullables
- Polymorphic functions dispatched on argument types
- Protocols for constraining polymorphic matches
- Optional lexically-enforced lifetimes to prevent both memory leaks and use-after-free
- Lisp-style macros
While already quite capable, Nucleus is not necessarily suitable for human consumption at this stage. The documentation is LLM-generated, breaking changes will come without warning, and it's likely buggy.
You'll need LLVM and clang. The compiler bootstrap IR is the boot submodule, which make fetches if you cloned without --recurse-submodules. Run
make
and you'll have bin/nucleusc. You can run
sudo make install
for system-wide installation. It should compile on Windows and Mac OS too, but this is untested.