/gifcc

Tiny c compiler

Primary LanguageCMIT LicenseMIT

gifcc CircleCI codecov

"gifcc" is a self-hosted C compiler written by gifnksm.

Features

  • emit x86_64 assembly (AT&T syntax or Intel syntax)
  • self-hosted
  • Many C11 features
  • Some GNU syntax extension

Compiler Stages

gifcc build process has 3 stages.

  • stage1: gifcc binary built with system's C compiler (gcc)
  • stage2: gifcc binary built with stage1 gifcc
  • stage3: gifcc binary built with stage2 gifcc

If gifcc compiles C source code correctly, stage2 binary and stage3 binary will be identical.

Requirements

  • C development tools (gcc, GNU Make, ...)
  • python3
  • TMSU (for running c-testsuite)

Operations

  • Build stage1, 2, 3 compiler

    $ make stage1
    ...
    $ make stage2
    ...
    $ make stage3
    ...
  • Run basic tests for each stages

    $ make stage1-test
    ...
    $ make stage2-test
    ...
    $ make stage3-test
    ...
  • Run all tests for each stages

    $ make stage1-test-full
    ...
    $ make stage2-test-full
    ...
    $ make stage3-test-full
    ...

Special Thanks

References