💾 Archived View for jb55.com › ward.bay.wiki.org › c-in-4-funs captured on 2021-12-05 at 23:47:19. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-04)

-=-=-=-=-=-=-

C in 4 Funs

This self-compiling subset of C is written in one 500 line file containing four functions. Branches add syntactic sugar like struct and switch. github

github

Inspiration for Another Mini ARM C Compiler (AMaCC) built from scratch, supporting ARM architecture, with three execution modes: interpret, JIT or ELF for ARM. github

github

Functions

next() scans for next token.

expr(int lev) compiles expressions.

stmt() compiles statements.

main(int argc, char **argv) alloc, compile and execute.

Use

Bootstrap the compiler with gcc.

Compile and execute one file.

Compile the compiler which then executes to compile and execute the next argument.

Nest the compiler-compiles which execute recursively.