Image missing.
SectorC: A C Compiler in 512 bytes (2023)

created: Feb. 7, 2026, 5:39 p.m. | updated: Feb. 8, 2026, 6:52 a.m.

For example, the following program animates a moving sine-wave:int y; int x; int x_0; void sin_positive_approx() { y = ( x_0 * ( 157 - x_0 ) ) >> 7; } void sin() { x_0 = x; while( x_0 > 314 ){ x_0 = x_0 - 314; } if( x_0 <= 157 ){ sin_positive_approx(); } if( x_0 > 157 ){ x_0 = x_0 - 157; sin_positive_approx(); y = 0 - y; } y = 100 + y; } int offset; int x_end; void draw_sine_wave() { x = offset; x_end = x + 314; while( x <= x_end ){ sin(); pixel_x = x - offset; pixel_y = y; vga_set_pixel(); x = x + 1; } } int v_1; int v_2; void delay() { v_1 = 0; while( v_1 < 50 ){ v_2 = 0; while( v_2 < 10000 ){ v_2 = v_2 + 1; } v_1 = v_1 + 1; } } void main() { vga_init(); offset = 0; while( 1 ){ vga_clear(); draw_sine_wave(); delay(); offset = offset + 1; if( offset >= 314 ){ // mod the value to avoid 2^16 integer overflow offset = offset - 314; } } }ScreenshotBut, how? So dreamed up a C that is technically still a C, is probably turing-complete, and will definitely make every code maintainer terrified. šŸ˜I will call it the Barely C Programming Language:int done , a , b , c , p , cond ; int(main)(){while(!done){ a = b - c ; *(int*) p = b - c ; a = *(int*) p ; if(cond) a = b - 45 ; }}Here we have spacing strategically placed to create ā€œmega-tokensā€For example: int(main)(){while(!done){ is one such "mega-token". In a sense, we actually have a language more like:VAR_BEGIN done AND a AND b AND c AND p AND cond END MAIN_BEGIN a = b - c END DEREF p = b - c END a = DEREF p END COND a = b - 45 END MAIN_ENDBut, a normal C compiler will also recognize it as C! From 468 bytes ⇒ 303 bytes (165 bytes saving): 510 - 303 ⇒ 207 spare bytes to use for new features!

13Ā hours, 49Ā minutes ago: Hacker News