A Modern C11 compiler (STILL EARLY)

Cuik (pronounced 'Quick')

warning: unfinished

The plan is a modern C11 compiler which can mostly work with Clang, GCC, and MSVC while also introducing some new ideas.

Why write a C compiler?

  • To improve the compile times on debug builds without sacrificing features like I would with TCC.
  • To test out my upcoming (and currently private) compiler backend.
  • To add some extensions to improve the workflow of C programmers.
  • Because I can.

How to install?

Mac & Linux aren't ready yet but i'll be moving forward to those platforms in the upcoming months

You'll need MSVC installed on windows (i use link.exe for now... sorry, i'll write a linker soon enough)

Just take a C compiler and compile the compile.c file and run it, if you want an optimized build add RELEASE_BUILD as a preprocessor define with -D or /D. Then you should have a cuik executable in your build/ directory, you can add that directory to your path if you want.

How am I doing?

mostly aight, thanks for asking.

What are some cool new things?

One of my favorite new features are the live compiler (essentially an offline Godbolt but within a terminal) and the out of order declarations.

What architectures will you support?

I'll be starting with x64 but I plan on having Aarch64 support soon enough, it's mostly a matter of user-demand what other platforms I add though I probably won't be supporting anything with a segmented address space because I don't want to implement it.

What OSes will you support?

Ideally the essentials like Windows, Linux and MacOS but currently MacOS isn't setup and Linux has basic support (no live compiler)

Will it have optimizations?

It will eventually have a smart but non-aggressive optimizer but that's still a work in progress

What C extensions will you have?

I'll be supporting all the normal extensions such as:

  • pragma once
  • builtin bitmath (popcount, ffs, clz, ctz, etc)
  • __builtin_trap, __builtin_expect
  • x86 SIMD intrinsics
  • typeof
  • case ranges
  • computed goto

And some possibly novel extensions such as:

What's left?

It can currently compile programs using the subset of C it currently supports but it's still missing some essential details before it compiles any basic C program such as:

  • More tests
  • Bug fixes
  • Self hosting
  • Thread local
  • Atomics (halfway there)
  • MSVC extensions
  • GNU extensions
  • Proper Mac/Linux support

PS

If you're wondering about the tinybackend static library, it's essentially a project of mine that's not ready for everyone's precious eyes so i've been sharing it just enough to actually let people play with the compiler but not play with the backend (it'll be open source eventually).

Owner
Yasser Arguelles
Human
Yasser Arguelles
Similar Resources

PL/0 Compiler Extension(including repeat, for, case, function, real, record and so on)

EX-PL0 PL/0 Compiler Extension(including repeat, for, case, function, real, record and so on) Structure src/PL source code of PL compiler; src/interpr

Jul 6, 2021

A simple assembler, made primarily for assembling output from my compiler.

Assembler This assembler is not currently meant for general use. It supports only the instructions and features emitted (and used) in my C compiler. I

Nov 14, 2021

Pure Data patch export to lv2 plugin using heavy compiler + dpf example

 Pure Data patch export to lv2 plugin using heavy compiler + dpf example

Pure Data patch export to lv2 plugin using heavy compiler + dpf example Work in progress - Takes an audio input and writes to a 0.5 seconds buffers. 4

Oct 19, 2021

Set of examples how to use CLion with various unsupported compilers using Custom Defined Compiler feature

About This repository contains: Set of examples how to use CLion with various unsupported compilers using Custom Defined Compiler feature Public set o

May 9, 2022

A PL/I compiler for Windows NT

PLI-2000 A PL/I compiler for Windows NT This project began as an academic exercise while learning the 'C' language during the summer of 1990, I wanted

Apr 20, 2022

Practical assignments for the XDU compiler course: The interpreter of function drawing language.

drawing-lang-interpreter Practical assignments for the XDU compiler course: The toy interpreter of function drawing language, written by XDU Zhang Yi(

Apr 22, 2022

The C source code was RESTORED by disassembling the original executable file OPTIM.COM from the Hi-Tech v3.09 compiler.

The C source code was RESTORED by disassembling the original executable file OPTIM.COM from the Hi-Tech v3.09 compiler. This file is compiled by Hi-Te

Mar 30, 2022

A skeleton C compiler in C++

cppc C compiler in C++ Background This is a learning project for Crafting interpreters. Most part of C is supported. Support for pointer is hacky. For

Feb 10, 2022

Skyline's fork of yuzu's shader compiler

Skyline Shader Compiler (SSC) A fork of yuzu's shader compiler modified for Skyline's needs with all other changes being upstreamed and changes from y

May 15, 2022
Comments
  • Simple Fix to Allow Compilation On MSVC

    Simple Fix to Allow Compilation On MSVC

    When compiling with MSVC, cc_command doesn't isn't declared. This PR adds a declaration with a default value of 0. This function isn't called when compiling with MSVC, but it still blocks compiling compile.c

    image

This project contains information on the PC-Link hardware interface for some early 2000 Sony HiFi decks
This project contains information on the PC-Link hardware interface for some early 2000 Sony HiFi decks

pclink-i2c This project contains information on the PC-Link hardware interface for some early 2000 Sony HiFi decks, such as the CMT-DC500MD (also know

Jan 21, 2022
Collection of cross-platform single-header C libraries for doing a lot of stuff! (Still WIP)

ice_libs Collection of cross-platform single-header C libraries for doing a lot of stuff! (Still WIP) Brief ice_libs is collection of Single-Header C

May 19, 2022
CVE-2021-24084 Windows Local Privilege Escalation Left officially unpatched since 2020. Hence, its still a zero day

WindowsMDM-LPE-0Day Works best on Windows 11 CVE-2021-24084 Windows Local Privilege Escalation Left officially unpatched since 2020. Hence, its still

May 1, 2022
Orca - Advanced Malware with multifeatures written in ASM/C/C++ , work on all windows versions ! (some features still under developing and not stable)
Orca - Advanced Malware with multifeatures written in ASM/C/C++ , work on all windows versions  !  (some features still under developing and not stable)

About Orca Orca is an Advanced Malware with multifeatures written in ASM/C/C++ features Run in Background (Hidden Mode) Records keystrokes and saves t

May 8, 2022
Faster neofetch alternative, written in C. Still improving :)
Faster neofetch alternative, written in C. Still improving :)

albafetch ~by alba4k albafetch is a simple, fast system fetching program. It prints many info about the system in way less than a second. I decided to

May 17, 2022
CHIP-8 interpreter in C11

shoganai | しょうがない It means accepting what happens beyond our control and cannot be avoided. It is used to encourage people to move forward without bei

Sep 28, 2021
Single-header C11 port of abseil.io's Swiss Table

cwisstable.h cwisstable is a single-header C11 port of the Abseil project's Swiss Tables. This project is intended to bring the proven performance and

May 5, 2022
Macro magic for declaring/calling Objective-C APIs from C11 or C++. Preloads selectors, chooses the correct objc_msgSend to call per method/platform.

OC - Easily Declare/Invoke Objective-C APIs from C11 or C++11 Usage // Call class and instance methods: NSWindow* const nswindow = oc_cls(NSWindow,new

Nov 20, 2021
Compiler Optimizations Playground

This is (hopefully) the simplest implementation of the classic register-machine intermediate representation (IR) to undertake data and control flow analysis in a compiler middle-end.

Apr 9, 2022