Menu

1 / 2

We Wrote a Compiler in the Language It Compiles. It Works.

DEV Community·Art·6 months ago
#HBegdnjP
#sprint#showdev#code#exit#enter
Reading 0:00
15s threshold

Four sprints. One afternoon. 62 tests, all green.

ForgeIL is the compiler layer of Forge - an open source UI framework built around

a radical simplicity: one language, one binary, no runtime installation.

The Idea

There is a test every language eventually faces. Not a benchmark. Not a syntax

comparison. A question:

Can the language compile itself?

A self-hosted compiler is the closest thing software has to a proof of maturity.

If the language can express a lexer, a parser, and a code generator - and the

result of running that code is a working binary - then the language has crossed

a threshold. It is no longer a demo. It is a tool.

SMS is the scripting language at the heart of Forge. It is interpreted at

development time and compiled to LLVM IR at release time. We decided to test

whether SMS could implement its own compiler front-end: a lexer, a parser, and

an LLVM IR emitter - all written in SMS itself.

Four sprints. One afternoon.…

Continue reading — create a free account

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