Live data from Hacker News

I built a programming language using Claude Code

ankursethi.com

91–100 of 194 posts

Re: I built a programming language using Claude Code

#91
post #77

Earlier quoted context omitted.

That's an interesting idea. But IMO the real 'token saver' isn't in the language keywords but it's in the naming of things like variables, classes, etc. There are languages that are already pretty sparse with keywords. e.g in Go you can write 'func main() string', no need to define that it's public, or static etc. So combining a less verbose language with 'codegolfing' the variables might be enough.

Go is one of the most verbose mainstream programming languages, so that's a pretty terrible example.

To you maybe, but Go is running a large amount of internet infrastructure today.

Re: I built a programming language using Claude Code

#93
> More addictive than that is the unpredictability and randomness inherent to these tools. If you throw a problem at Claude, you can never tell what it will come up with. It could one-shot a difficult problem you’ve been stuck on for weeks, or it could make a huge mess. Just like a slot machine, you can never tell what might happen. That creates a strong urge to try using it for everything all the time.

That is the part of the post that stuck with me, because I've also picked up impossible challenges and tried to get Claude to dig me out of a mess without giving up from very vague instructions[1].

The effect feels like the Loss-Disguised-As-Win feeling of the video-games I used to work on at Zynga.

Sure it made a mistake, but it is right there, you could go again.

Pull the lever, doesn't matter if the kids have Karate at 8 AM.

[1] - https://github.com/t3rmin4t0r/magic-partitioning

Re: I built a programming language using Claude Code

#94
post #77

Earlier quoted context omitted.

That's an interesting idea. But IMO the real 'token saver' isn't in the language keywords but it's in the naming of things like variables, classes, etc. There are languages that are already pretty sparse with keywords. e.g in Go you can write 'func main() string', no need to define that it's public, or static etc. So combining a less verbose language with 'codegolfing' the variables might be enough.

Go is one of the most verbose mainstream programming languages, so that's a pretty terrible example.

Maybe not a perfect example but it’s more lightweight than Java at least haha

Re: I built a programming language using Claude Code

#95

Earlier quoted context omitted.

> Impressive. As a practical matter, one wonders what th point would be in creating a new programming languages if the programmer no longer has to write or read code. I'm working on a language as well (hoping to debut by end of month), but the premise of the language is that it's designed like so: 1) It maximizes local reasoning and minimizes global complexity 2) It makes the vast majority of bugs / illegal states im…

How does a programming language prevent the vast majority of bugs? I feel like we would all be using that language!

See Rust with Use-after-Free, fearless concurrency, etc.

My language is a step ahead of Rust, but not as strict as Ada, while being easier to read than Swift (especially where concurrency is involved).

Re: I built a programming language using Claude Code

#96
post #55

Earlier quoted context omitted.

> but every AI coding bot will learn your new language as a matter of course after its next update includes the contents of your website. That's assuming that your new, very unknown language gets slurped up in the next training session which seems unlikely. Couldn't you use RAG or have an LLM read the docs for your language?

Neither RAG nor loading the docs into the context window would produce any effective results. Not even including the grammar files and just few examples in the training set would help. To get any usable results you still need many many usage examples.

And yet it works well enough, regardless. I have a little project which defines a new DSL. The only documentation or examples which exist for this little language, anywhere in the world, are on my laptop. There is certainly nothing in any AI's training data about it. And yet: codex has no trouble reading my repo, understanding how my DSL works, and generating code written in this novel language.

Re: I built a programming language using Claude Code

#98

Earlier quoted context omitted.

In addition, I think token efficiency will continue to be a problem. So you could imagine very terse programming languages that are roughly readable for a human, but optimized to be read by LLMs.

That's an interesting idea. But IMO the real 'token saver' isn't in the language keywords but it's in the naming of things like variables, classes, etc. There are languages that are already pretty sparse with keywords. e.g in Go you can write 'func main() string', no need to define that it's public, or static etc. So combining a less verbose language with 'codegolfing' the variables might be enough.

I'm not an expert in LLMs, but I don't think character length matters. Text is deterministically tokenized into byte sequences before being fed as context to the LLM, so in theory `mySuperLongVariableName` uses the same number of tokens as `a`. Happy to be corrected here.

Re: I built a programming language using Claude Code

#99

I recently tried using Claude to generate a lexer and parser for a language i was designing. As part of its first attempt, this was the code to parse a float literal: fn read_float_literal(&mut self) -> &'a str { let start = self.pos; while let Some(ch) = self.peek_char() { if ch.is_ascii_alphanumeric() || ch == '.' || ch == '+' || ch == '-' { self.advance_char(); } else { break; } } &self.source[start..self.pos] } A…

I had a somewhat experience with Claude coding an Occam parser but I just let it do it's thing and once I had presented it with a suitable suite of test source code, it course corrected, refactored and ended up with a reasonable solution. The journey was a bit different to an experienced human developer but the results much the same and perhaps 100X cheaper.

Some of the issues are undoubtedly that I have a decidedly non-standard architecture for my system that the AI refuses to acknowledge--it hallucinated things like integers, which isn't a part of my system, simply because what I have looks almost like a standard example expression grammar so clearly I must have all of the standard example expression grammar things. (This is a pretty common failure mode I've noticed in AI-based systems--when the thing you're looking for is very similar to a very notable, popular thing, AI systems tend to assume you mean the latter as opposed to the former.)

Re: I built a programming language using Claude Code

#100

I've been working on a large codebase that was already significant before LLM-assisted programming, leveraging code I’d written over a decade ago. Since integrating Claude and Codex, the system has evolved and grown massively. Realistically, there’s a lot in there now that I simply couldn't have built in a standard human lifetime without them. That said, the core value of the software wouldn't exist without a human a…

This is the take, very well said. I've been trying to use analogies with cars and cabinet making, but building a house is just right for the scale and complexity of the efforts enabled, and the ownership idea threads into it well.

Going into the vault!

Post reply on HN