r/Compilers • u/ElephantElectrical31 • Oct 15 '26
Nikaia: a pre-alpha language where the compiler figures out the "how". How would you like to experiment with it?
Hi all,
I've been building Nikaia, a language that should make the world a bit better.
The basic idea is simple: in a lot of systems code, you end up specifying how memory, waiting, sharing, etc. should work rather than just describing what you want the program to do. Nikaia tries to have the compiler figure out those details for you.
So there’s no async/await, GC, or manual memory management. Data races, missing values and unhandled errors are compile-time errors, with plain-language hints about what to do instead.
It's still very early, but it can already build real programs: a JSON parser, a log analyser, a small HTTP server, the One Billion Row Challenge, and more.
Nikaia itself is built almost entirely by AI agents, and they're currently rewriting the compiler in Nikaia (self-hosting). So the language is getting quite a bit of real-world use already.
I'd love to have people try it and tell me what makes sense, what doesn't, and where the language gets in the way. "This can't work because..." is just as useful as praise.
What would make that easy for you?
- Is the repo enough?
- A crate you can "cargo install"?
- A prebuilt executable?
- A Docker image with everything set up?
- An LSP / IDE integration?
Repo: https://github.com/Nikaia-Language/Nikaia
Docs: https://nikaia-lang.org/
5
u/FransFaase Oct 15 '26
I was expecting a specification language, but when I had a quick glance on the syntax it just looks like one of the many imperative languages.
Why for example does it have different integer types and why not let the compiler decide which to use based on the specification of the input parameters.
2
u/Inconstant_Moo Oct 16 '26 edited Oct 16 '26
The documentation is terrible like all AI-written documentation in that it's constantly telling us things that can't possibly interest us.
But also, the AIs that wrote your documents are overhyping the AIs that wrote your code. A couple of particularly annoying bits of hype.
(1)
Well, no, of course it doesn't actually do that because this is completely impossible. What it actually does is throw a compile-time error if it can prove that the assertion will fail. Obviously you can't guarantee that it will always be able do that when it will fail (because of this being impossible), and since your example is of your compiler essentially catching you trying to divide by a literal
0, not even by1 - 1, we have to wonder how hard it tries.This is not "formal verification". You shouldn't call it that. This is a runtime feature that will occasionally cause a compile-time error if I do something really boneheaded. What it "formally verifies" is that either there's no bug or that your compiler isn't smart enough to detect it. Hooray!
It also seems to me that the language construct as it stands is superfluous. Because you could also write at the start of the function
if whole > 0 throw <your error constructor here>and have the compiler (as mine does) throw an error if it can prove that an expression other than an error constructor must always return an error --- a general case which includes division by zero and trying to take the 10th character of"aardvark"or whatever. Doesassertgive you anything else?(2) Your manifesto says you want simple and fast (something that lots of people have wanted btw), and in particular something that mends the "schism" between scripting languages and systems languages. And your landing page says "Nikaia reads like a scripting language and compiles like a systems language". But the first function I see in your docs looks like this:
name: ref Stringdoesn't look like a scripting language. Your description of Nikaia's memory semantics isn't at all simple. Maybe it is by comparison to Rust. That's a low bar. Errors have to be declared on the return types or it's a compile-time error. The language forces me to handle null cases if they're possible in the type system. I need a project folder with a manifest file in TOML format before I can run anything.Etc, etc. Every time you've had to choose between systems language and scripting language, you've gone full systems language. There's been no attempt at compromise except leaving out some bits of some systems languages. Go gets closer, or Julia, or Mojo.
Claiming simplicity by what you leave out is disingenuous if you put something equally complex in. You have no async and await, you say? No, you have this.
Your hypothesis as to why people haven't tried to combine the ease of scripting languages with the speed of compiled languages is unconvincing. First, they kind of have; second, you kind of haven't.
But also, the idea of a "schism" in your manifesto is just the wrong way of looking at it. We want different languages for different things, just like carpenters want different saws for different things. The things I can do, and ought to be able to do, in JavaScript, to make a bunch of components which I can modify from the inside out or outside in, are different from the things that I should be able to do in a systems language. I'd be horrified if I could. JS is slow because it has to be able to change the shape of data at runtime, attach new methods to an object at runtime, etc.
1
u/SwedishFindecanor Oct 15 '26
overlaplooks like async-await with more primitive syntax.(It also reminds me of a parallel language I read about in 2005 that I think had exactly the same thing, but I can't remember what it was called)