https://github.com/jordanhubbard/nanolang/blob/main/MEMORY.m...
Optimistically I dumped the whole thing into Claude Opus 4.5 as a system prompt to see if it could generate a one-shot program from it:
llm -m claude-opus-4.5 \
-s https://raw.githubusercontent.com/jordanhubbard/nanolang/refs/heads/main/MEMORY.md \
'Build me a mandelbrot fractal CLI tool in this language'
> /tmp/fractal.nano
Here's the transcript for that. The code didn't work: https://gist.github.com/simonw/7847f022566d11629ec2139f1d109...So I fired up Claude Code inside a checkout of the nanolang and told it how to run the compiler and let it fix the problems... which DID work. Here's that transcript:
https://gisthost.github.io/?9696da6882cb6596be6a9d5196e8a7a5...
And the finished code, with its output in a comment: https://gist.github.com/simonw/e7f3577adcfd392ab7fa23b1295d0...
So yeah, a good LLM can definitely figure out how to use this thing given access to the existing documentation and the ability to run that compiler.
The thing that really unlocked it was Claude being able to run a file listing against nanolang/examples and then start picking through the examples that were most relevant to figuring out the syntax: https://gisthost.github.io/?9696da6882cb6596be6a9d5196e8a7a5...
# Control flow
if (> x 0) {
(println "positive")
} else {
(println "negative or zero")
}
But that's nothing compared to the scream for a case/switch-statement in the Mandelbrot example... # Gradient: " .:-=+*#%@"
let gradient: string = " .:-=+*#%@"
let gradient_len: int = 10
let idx: int = (/ (* iter gradient_len) max_iter)
if (>= idx gradient_len) {
return "@"
} else {
if (== idx 0) {
return " "
} else {
if (== idx 1) {
return "."
} else {
if (== idx 2) {
return ":"
} else {
if (== idx 3) {
return "-"
} else {
if (== idx 4) {
return "="
} else {
if (== idx 5) {
return "+"
} else {
if (== idx 6) {
return "*"
} else {
if (== idx 7) {
return "#"
} else {
if (== idx 8) {
return "%"
} else {
return "@"
}
}Maybe I’m missing some context, but all that actually should be needed in the top-level else block is ‘gradient[idx]’. Pretty much anything else is going to be longer, harder to read, and less efficient.
Logically this still would be a case/switch though...
There's no need for any conditional construct here whatsoever.
You'll note it has already constructed a string in the right order to do that, but then copped out with the if-else.
(char_at s index) # Get ASCII value at index (0-based)
(string_from_char code) # Create string from ASCII value
So, you can pluck a character... From an UTF-8 string? What if the rendering used multibyte characters?Ed: There seems to be an UTF-8 library:
https://github.com/jordanhubbard/nanolang/tree/main/modules/...