Skip to content

rozukke/cig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

 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:

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.

About

C compiler written in Zig.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages