# Fuzzing the Gleam Compiler: Finding Bugs by Generating Random Programs

> Hacker News story 49436706 · language: en · submitted 2026-08-25
> Web version: https://zeli.app/story/49436706
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 72 · by [crowdhailer](<https://news.ycombinator.com/user?id=crowdhailer>) · 💬 10
[original](<https://www.kurz.net/posts/fuzzing-gleam-compiler>) · [HN discussion](<https://news.ycombinator.com/item?id=49436706>)

## Summary

Gleam is a functional language that compiles to both Erlang and JavaScript, making it an ideal candidate for structure-aware fuzzing. The author built a fuzzer that generates random Gleam programs to uncover compiler bugs, particularly those causing differences between the two backends. The project uses a generation-based approach, leveraging the compiler's public API to test the parser and type checker. It found a regression in the nightly build involving a pipeline operator in a const expression. The author plans to extend the fuzzer to generate type-safe programs for deeper testing.

## Key quote

> One is definitely more than zero.

## HN discussion (10 comments)

### [nwellnhof](<https://news.ycombinator.com/item?id=49442435>)

> \> We can compare the output of the same program for both targets and flag any differences.
>
> This is called differential fuzzing and is one of the most powerful methods to find bugs in all kinds of software.

### [goranmoomin](<https://news.ycombinator.com/item?id=49440550>)

> I do have a hunch in that we might be able to utilize tiny LLMs to figure out parts that might possibly be brittle and combine them with traditional generation/mutation-based fuzzing to generate fuzz targets that are more likely to trigger an edge case.
>
> I did not think of applying LLMs on fuzzing at all until I saw llvm-hackme[0] which does both traditional mutation fuzzing as well as LLM-generated targeted regression test cases, where the LLM is pretty effective in understanding the PR and targeting edge cases! It was pretty impressive and I keep getting to think on how we can actually combine LLMs to make fuzzing much more efficient & effective.
>
> // Sorry about the yet-another-LLM-comment. I really love PLs and I'm terribly sorry that I'm contributing yet another LLM-related content (instead of the more interesting stuff!)
>
> [0]: https://github.com/dtcxzyw/llvm-hackme

### [stephenlf](<https://news.ycombinator.com/item?id=49436805>)

> Fantastic article. Thanks for sharing. I love the honest take on LLM-based fuzzing. It’s exactly something I would do with a similar problem.

---

## Cite

- Page: https://zeli.app/story/49436706
- Date: 2026-08-25
- Source: kurz.net (https://www.kurz.net/posts/fuzzing-gleam-compiler)
- Hacker News: https://news.ycombinator.com/item?id=49436706

## Other languages

- zh: https://zeli.app/zh/story/49436706 · markdown: https://zeli.app/zh/story/49436706.md
- ja: https://zeli.app/ja/story/49436706 · markdown: https://zeli.app/ja/story/49436706.md
- ko: https://zeli.app/ko/story/49436706 · markdown: https://zeli.app/ko/story/49436706.md
- de: https://zeli.app/de/story/49436706 · markdown: https://zeli.app/de/story/49436706.md
- es: https://zeli.app/es/story/49436706 · markdown: https://zeli.app/es/story/49436706.md
- ru: https://zeli.app/ru/story/49436706 · markdown: https://zeli.app/ru/story/49436706.md
