Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 2.6 KB

README.md

File metadata and controls

57 lines (39 loc) · 2.6 KB

Cwerg

The best C-like language that can be implemented in 10kLOC

Status GitHub stars Discord

Cwerg aims to be a complete, compact and fast "from-scratch" compiler for a C-like language. It has no dependencies and consists of the following components:

To get started hacking on Cwerg please read getting_started.md.

Philosophy

Most components are implemented twice (see rationale):

  1. spec/reference implementation: Python 3.10
  2. high performance implementation: C++20 (with limited STL usage)

Re-implementations in other languages are explicitly encouraged. A lot of code is table driven to facilitate that.

Cwerg de-emphasizes quality of the generated code (the hope is to come within 50% of state of the art compilers) in favor of a small code base that can be understood by a single developer and very fast translation times.

Explicit line number targets are in place to prevent feature creep:

The translation speed target is 1000k LOC per sec using at most 4 cores on a 2020 era midrange desktop or high end laptop.

Inspirations