Planck Lang compiler, standard library sources, and a reference .plk -> .c compiler.
About five years ago, my friend Adam and I wrote a standard library / spec and the start of a compiler for a language called Planck. It was one of many languages and compilers we tried to write. Planck was never finished, but the spec still exists, so I gave it to Codex to see if it could make a grammer definition, a compiler, and a standard library. The grammer was easy, the compiler seems to work for most standard cases, but the standard library does not compile correctly because of limitations in the compiler.
It seems like either the standard library has contradictory features that prevented Codex from making a compiler that worked to compile it, or Codex couldn't capture all of those features in its implementation. My guess is a latter based on the code I've read. The specific issues are the use of generic types, incorrectly using self when it's undefined, etc.
Generative AI does still seem rather far from being able to build an entire compiler, even with many examples, but it's getting a lot closer every month. I will likely return to this in another five years to see if it can make a completely functional language using our Planck syntax.
The following in 100% AI generated with Codex and GPT 5.2.
src/: existing stdlib.plkfiles (io,list,math,struct)docs/grammar.md: formal language grammardocs/language-guide.md: language and compiler usage docscompiler/: lexer, tokenizer, parser, and C code generatorexamples/: runnable sample.plkprograms
python3 -m compiler.plkc examples/basic.plk -o /tmp/basic.c
gcc -std=c11 -Wall -Wextra -o /tmp/basic /tmp/basic.c
/tmp/basicadd(a: int, b: int): int {
return a + b;
}
main(): int {
nout("Hello, Planck!");
int result = add(2, 3);
nout(result);
return 0;
}python3 -m compiler.plkc examples/hello_math.plk -o /tmp/hello_math.c
gcc -std=c11 -Wall -Wextra -o /tmp/hello_math /tmp/hello_math.c#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
int add(int a, int b);
int main(void);
int add(int a, int b) {
return (a + b);
}
int main(void) {
printf("%s\\n", "Hello, Planck!");
int result = add(2, 3);
printf("%d\\n", result);
return 0;
}Hello, Planck!
5