https://github.com/mabogiqwa/c-compiler
Creating c-compiler
https://github.com/mabogiqwa/c-compiler
automata-theory c programming-languages
Last synced: 2 months ago
JSON representation
Creating c-compiler
- Host: GitHub
- URL: https://github.com/mabogiqwa/c-compiler
- Owner: mabogiqwa
- Created: 2026-02-12T11:20:12.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-02-19T19:52:16.000Z (4 months ago)
- Last Synced: 2026-02-19T22:31:55.185Z (4 months ago)
- Topics: automata-theory, c, programming-languages
- Language: C++
- Homepage:
- Size: 27.3 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# c-compiler
Building a mechanism that can translate C into machine code.
## Design decisions
The compiler will be 32-bit, little-endian with a flat memory model. It will process identifiers such as conditionals, loops, functions, and integers for now.
## Preprocessing
This component will handle include declarations, macros, and conditional compilations.
## Lexical Analysis
Turns characters into tokens. Token types include identifiers, numbers, operators, and symbols.
## Parser
Turns tokens into an abstract syntax tree.
## Semantic Analysis
Going to involve symbol tables and with checking whether rules are enforced.
## Intermediate Representation
Turns abstract syntax trees into a simpler, lower-level form. We could use a 3-address code. This helps simplify optimization and code generation. Also decouples frontend and backend.
## Code generation
The goal is that the intermediate representation is turned into 32-bit machine code or assembly. This will require a stack frame layout, register usage and how expressions map to instructions.
## Linking
Provides a form of runtime support.