Live data from Hacker News

I Built a Scheme Compiler with AI in 4 Days

matthewphillips.info

21–30 of 34 posts

Re: I Built a Scheme Compiler with AI in 4 Days

#21
post #12

This is cool, I got Codex to vibe code a Forth compiler for the NES and it worked fine, but I have to say that it is decidedly not fun. Instead of figuring out how to solve every bug and becoming intimately familiar with with the code, I just delegate all the work to virtual interns and I sit and wait. I decided to write my own Forth compiler without AI assistance as a result. Side projects should be fun and for lear…

I think the difference is in why you want a forth compiler on the nes. Is it because you want to dig in and learn how a compiler on the nes would work? Or do you want a compiler so you can use it for something else you’re interested in doing? If your goal is the first one, then vibe coding is not going to be a good fit.

Re: I Built a Scheme Compiler with AI in 4 Days

#22
post #14
post #12

This is cool, I got Codex to vibe code a Forth compiler for the NES and it worked fine, but I have to say that it is decidedly not fun. Instead of figuring out how to solve every bug and becoming intimately familiar with with the code, I just delegate all the work to virtual interns and I sit and wait. I decided to write my own Forth compiler without AI assistance as a result. Side projects should be fun and for lear…

We need a new pair of words to distinguish these two mindsets. Digging deep, finding abstractions, solutions that would say more with less .. is one kind of fun. Other people want to see the magic happen by doing few keystrokes it seems, they call it fun, i call it death.

> they call it fun, i call it death.

Are you just sitting there as if dead when using AI? I find AI work exciting, always something new to discover.

Re: I Built a Scheme Compiler with AI in 4 Days

#23

> I run into bugs all the time so it’s probably not ready for anyone other than me to use, but I’ve managed to go pretty deep (if not wide) in just a few days of work. Having similar experience with my experimental code generator to Rust. Every time a yet another example does not work, Claude fixes it. However, I am curious whether it would converge to a bullet-proof solution, or I have to carefully read the code and…

Are you using syn to pretty print a tree, or concatenating strings?

I think it helps having an intermediate tree where every value is valid rust code (not just synctactically, but it compiles and runs fine) helps a lot. Like an IR for your transpiler

Re: I Built a Scheme Compiler with AI in 4 Days

#24

detractors of AI claim this stuff is in its training data so it could be a copy which is valid. The crazy thing is the fact that it can definitely build something that does not exist.

how many scheme compilers do you think have been written?

Hundreds, this is one of the most famous functional programming exercises (mostly thanks to SICP). Just check https://github.com/search?q=scheme%20compiler&type=repositor... (858 results on github)

Re: I Built a Scheme Compiler with AI in 4 Days

#25
The column-number switch on the site is a clever idea, but I don't think it works. The columns are limited to a fixed height (that depends on their number). The fixed height forces readers to scroll down each column and then back to the top to read the next.

The site should imitate newspapers either more or less closely. In either case, first limit column height to something like 80% of the viewport to eliminate scrolling within columns. The column switch can select column width as a fraction of screen width.

More closely: when the content is too long for one set of columns, split it into multiple newspaper-style pages. The reader scrolls vertically through the newspaper pages.

Less closely: use columns arranged side-by-side in a horizontally scrollable container. The reader scrolls vertically to reach the container, then horizontally through the columns.

Re: I Built a Scheme Compiler with AI in 4 Days

#26
post #22
post #14

Earlier quoted context omitted.

We need a new pair of words to distinguish these two mindsets. Digging deep, finding abstractions, solutions that would say more with less .. is one kind of fun. Other people want to see the magic happen by doing few keystrokes it seems, they call it fun, i call it death.

> they call it fun, i call it death. Are you just sitting there as if dead when using AI? I find AI work exciting, always something new to discover.

It's been a few months since gemini 3 and opus 4.5 were released and I still regularly have feelings of dread in me because I'm deprived of something (which I assume is the thrill and pride of being able to explore solution spaces in non stupid ways to find plausible answers on my own)

Maybe it's the usual webdev corp job that is too focused on mainstream code and where AI is used to sell more, not find new ideas that could be exciting..

Re: I Built a Scheme Compiler with AI in 4 Days

#27
post #12

This is cool, I got Codex to vibe code a Forth compiler for the NES and it worked fine, but I have to say that it is decidedly not fun. Instead of figuring out how to solve every bug and becoming intimately familiar with with the code, I just delegate all the work to virtual interns and I sit and wait. I decided to write my own Forth compiler without AI assistance as a result. Side projects should be fun and for lear…

There is fun in what you use something for and doing the something. I think there is a big divide between people who just love making different tools from scratch by hand and the rest who love being able to instantly whip up a new tool in minutes AND THEN use it to create something fun. I literally would never ever in my existence be interested in making a compiler if I had nothing to use it for. If I ever wanted to…

I know what will blow your socks off: package managers. They are kind of like magical wizards that can make fully operational software appear on your machine. Want a scheme compiler? Just `nix-shell -p racket`. Want common lisp? `nix-shell -p sbcl`. It works like a charm every time.

Re: I Built a Scheme Compiler with AI in 4 Days

#28
post #12

This is cool, I got Codex to vibe code a Forth compiler for the NES and it worked fine, but I have to say that it is decidedly not fun. Instead of figuring out how to solve every bug and becoming intimately familiar with with the code, I just delegate all the work to virtual interns and I sit and wait. I decided to write my own Forth compiler without AI assistance as a result. Side projects should be fun and for lear…

I think the difference is in why you want a forth compiler on the nes. Is it because you want to dig in and learn how a compiler on the nes would work? Or do you want a compiler so you can use it for something else you’re interested in doing? If your goal is the first one, then vibe coding is not going to be a good fit.

In my case it’s because forth is one of the only high-level languages that has a chance of running at a playable speed on the NES, and I just like the language in general.

If you look at old school development manuals for stuff like the C64 your options, to get decent performance for something you are writing it seems like the options were “forth” or “assembly”, and I find forth easier to reason about.

To answer the true essence of your question though, I wanted a forth compiler as a means to making an NES game, but after I got Codex to generate the compiler I kind of realize that what I actually wanted was the entire experience of making an NES game, including building the compiler.

Re: I Built a Scheme Compiler with AI in 4 Days

#29
post #27

Earlier quoted context omitted.

There is fun in what you use something for and doing the something. I think there is a big divide between people who just love making different tools from scratch by hand and the rest who love being able to instantly whip up a new tool in minutes AND THEN use it to create something fun. I literally would never ever in my existence be interested in making a compiler if I had nothing to use it for. If I ever wanted to…

I know what will blow your socks off: package managers. They are kind of like magical wizards that can make fully operational software appear on your machine. Want a scheme compiler? Just `nix-shell -p racket`. Want common lisp? `nix-shell -p sbcl`. It works like a charm every time.

Sure but I can now create a subset of those packages which fit 100% my use case.

Also I don't know what you're arguing for, I was just saying that spending most of the time making tools without doing anything with them is not the only way for a developer to feel satisfied.

Re: I Built a Scheme Compiler with AI in 4 Days

#30
post #28

Earlier quoted context omitted.

I think the difference is in why you want a forth compiler on the nes. Is it because you want to dig in and learn how a compiler on the nes would work? Or do you want a compiler so you can use it for something else you’re interested in doing? If your goal is the first one, then vibe coding is not going to be a good fit.

In my case it’s because forth is one of the only high-level languages that has a chance of running at a playable speed on the NES, and I just like the language in general. If you look at old school development manuals for stuff like the C64 your options, to get decent performance for something you are writing it seems like the options were “forth” or “assembly”, and I find forth easier to reason about. To answer the…

I love FORTH and I agree that it would most likely run at a decent speed.

But just for reference it's worth pointing out out there was an official high-level language released for it, back in the day:

https://en.wikipedia.org/wiki/Family_BASIC

Post reply on HN