Elektrine lite

← Feed

@swetland@chaos.social

Post #1141048

2026-04-13 09:44 UTC

Anyone know of a collection of "interesting" little code chunks or algorithms for exercising compiler code generation, optimization, etc? Ideally stuff that's not too big (worst case a few functions, 100-200 lines of code or so), and has interesting code-flow properties, uses more than a handful of registers, does something computationally meaningful, does not depend on IO, (standard) library code, etc. Source in C/Go/Rust style languages a bonus. #Project #Compiler #PLdev

Replies (4)

  • @swetland@chaos.social 2026-04-13 09:47

    Right now my corpus of code to exercise the compiler is the compiler itself (~5000 lines of code) and an ever-growing library of little test cases (about 1000 lines across 50 tests at the moment), which is a start, but I'd love to have some interesting stuff between those extremes...

    Open ##1927995

  • @lexplt@hachyderm.io 2026-04-13 09:47

    @swetland mainly any problem on Rosetta Code, my favorites being Ackerman Peter function and n-queens solvers

    Open ##1927999

  • @tobyjaffey@mastodon.me.uk 2026-04-13 13:04

    @swetland (minimal IO) I found this nice little recursive maze generator which I was using to test an emulator https://github.com/ringtailsoftware/uvm32/blob/main/apps/maze/maze.c

    Open ##1928001

  • @robey@messydesk.social 2026-04-13 19:31

    @swetland one i got a lot of mileage out of: compute pi very badly to a requested precision (which doesn't get even a few digits right until 1000 rounds)

    Open ##1928004