Menu

1 / 5

MLIR, Nanopass, and Green-Red Trees: Compiler Ideas That Make Code Generators Better

DEV Community: scala·Alexander Novikov·8 months ago
#50eYOIk7
#dev#class#strong#code#article
Long article (1889 words) — no AI summary yet.
Reading 0:00
15s threshold

Most code generators are monolithic. A single class reads some input, makes a bunch of decisions, and spits out source files. It works until it doesn't — until you need to support another target language, until you need incremental builds, until a 2000-line generator method becomes everyone's least favorite file to touch.

I hit this wall while building Proto Wrapper Plugin , a tool that generates version-agnostic Java wrappers from multiple protobuf schemas. The generator worked fine, but every new feature meant wrestling with a monolith. Adding Kotlin support would have meant duplicating the entire thing.

So I went looking for better ideas.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.