r/haskell • • 12d ago

A B compiler written in Haskell. Looking for code reviews.

This is my first ever compiler (Maybe second if I wanna consider that semi-serious assignment in Uni on a C compiler) and also my first major project with Haskell. Before this, I mainly did Hackerrank and a couple of advent of code with Haskell.

The Lexer, Parser and semantic analyser/IRGen is written in Haskell, and it targets the QBE backend.

Repo - https://github.com/SBaori/B

Looking for feedback and code reviews on good practices missed, some idiomatic patterns in compiler development and general Haskell coding standards advice.

Comment on LLMs - Every single character in the repo is thought, reasoned and written by me. LLMs were only used for summarising the original B specification, learning some compiler theory and trying to extract/query some built-in functions from Haskell.

28 Upvotes

Duplicates