DoctorWkt/acwj logo

DoctorWkt/acwj

Free

A Compiler Writing Journey

FreeFree tier
Type
Open Source

About DoctorWkt/acwj

A practical, step-by-step guide to writing a self-compiling compiler for a subset of the C language. The repository documents the author's journey, covering topics such as lexical scanning, parsing, operator precedence, code generation, variables, functions, pointers, arrays, structs, unions, and more. Each part includes explanations with references to compiler theory, but the focus is on hands-on implementation.

Key Features

Self-compiling compiler for a subset of C
Over 60 documented parts from scanning to code generation
Practical, hands-on approach with minimal theory
Covers lexical scanning, parsing, operator precedence, assembly generation, variables, functions, pointers, arrays, structs, unions, enums, preprocessor, and more
Generates assembly for x86 and ARM platforms
Open source and free to use

Pros & Cons

Pros
  • Well-documented with clear explanations
  • Practical, project-based learning
  • Covers a wide range of compiler topics
  • Self-contained and easy to follow
  • Free and open source
Cons
  • Only supports a subset of the C language (not full C)
  • May not be suitable for production use
  • Requires prior programming knowledge

Best For

Learning compiler construction from scratchEducational resource for students and hobbyistsReference for building a simple C compilerUnderstanding how programming languages work under the hood

FAQ

What is this project about?
It is a step-by-step documentation of writing a self-compiling compiler for a subset of the C language, focused on practical implementation.
Is the compiler complete?
It covers many features of C but only a subset; details are provided in the repository's 60+ parts.