https://github.com/rozukke/cig
C compiler written in Zig.
https://github.com/rozukke/cig
Last synced: 11 days ago
JSON representation
C compiler written in Zig.
- Host: GitHub
- URL: https://github.com/rozukke/cig
- Owner: rozukke
- License: mit
- Created: 2025-02-17T13:51:37.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-18T05:36:25.000Z (8 months ago)
- Last Synced: 2025-02-18T06:31:04.367Z (8 months ago)
- Language: Zig
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
```
a, 8a
`8, `8) ,adPPRg,
8) ]8 ,ad888888888b
,8' ,8' ,gPPR888888888888
,8' ,8' ,ad8"" `Y888888888P
8) 8) ,ad8"" (8888888""
8, 8, ,ad8"" d888""
`8, `8, ,ad8"" G ,ad8""
`8, `" ,ad8"" I ,ad8""
,gPPR8b C ,ad8""
dP:::::Yb ,ad8""
8):::::(8 ,ad8""
Yb:;;;:d888""
"8ggg8P"
```# cig
The coolest C compiler in town... he even smokes.
Built by following Nora Sandler's "Writing a C Compiler" book using Zig.## Usage
> [!IMPORTANT]
> Supports Linux and MacOS. Tested on Ubuntu 24.04 x86_64.To run on a C source file, you can use the below command:
```bash
zig build run -- source.c```
Below commands are available to test separate compiler stages:
- `--lex`: stop at lexing
- `--parse`: stop at parsing
- `--codegen`: stop at codegen
- `-S`: emit assembly but do not assemble## Progress
Currently finished with Chapter 1, meaning that the compiler can currently:
- Compile programs that can return an integer in a single top level main function
- Detect syntax and language errors related to the above
- Display basic error messages## LICENSE
**See LICENSE file.**
**Copyright © 2025 Artemis Rosman**Header ASCII art by Normand Veilleux.