The letter S in a light blue, stylized speech bubble followed by SpeakBits
SpeakBitsThe letter S in a light blue, stylized speech bubble followed by SpeakBits
Trending
Top
New
Controversial
Search
Groups

Enjoying SpeakBits?

Support the development of it by donating to Patreon or Ko-Fi.
About
Rules
Terms
Privacy
EULA
Cookies
Blog
Have feedback? We'd love to hear it!

Exploring the c4... compiler?

thorstenball.com
submitted
a year ago
bykaiserseahorsetoprogramming

Summary

This week I found myself digging through the code of c4, an implementation of C “in four functions”, by Robert Swierczek. c4 is dense, barely commented, and, frankly, strange. It’s unlike anything else I had come across in compiler land.

There are no structs in c4.c. It takes 39 VM cycles to execute my_program.c and 59822 cycles to executed c4-c4. c4 is a self-hosting language. A language that’s just small enough so you can build a compiler in it.

All the other instructions and their implementations are C at its … most C — very, very dense. Then there’s the fact that the base type is an integer. Or that it has a debug mode. Or…Isn’t it amazing what code is floating around, out there in the world, ready to reveal secrets and delight?

 web site website internet site site scoreboard oscilloscope scope cathode-ray oscilloscope CRO monitor-0
8

0 Comments

There are no comments on this post yet.