Giter Club home page Giter Club logo

c's Introduction

A smaller, faster C compiler suite.

  • Fast.
  • Consistent.
  • Small.
  • High quality.
  • Low complexity.
  • No dependencies.
  • No fussy configuration.
  • Painless cross compiling.
  • Just work.

Building

Requires an external C compiler and gnu binutils (for now).

$ make

Testing

$ bash test.sh

Plan

Stage 1.

Self hosting x86_64, dumb backend.

Stage 2.

Self hosting arm, something like raspberry pi/android.

Stage 3.

Build small clean C code bases like 8cc, tcc, sbase.

Stage 4.

Build musl libc.

Beyond.

  • Build more programs.
  • Replace gnu as with our own assembler.
  • Replace ld with our own static linker.
  • Build OS kernels.
  • Advanced SSA backend.

Status

Pre stage 1.

See tests for what works.

Code layout

  • Libraries are in src/*
  • Commands are in src/cmd/*

If you are unsure about the purpose of a library, check the header which should give a short description.

Code style

Follow Plan9 style conventions. Headers are not allowed to include other headers to eliminate circular dependencies and increase build speed. src/u.h is the only exception to this rule.

Bug fixes and issues.

Try and attach a single source file which exibits your issue. If possible reduce the test case by hand until it is as small as possible.

Try and follow the general template changed where needed:

What are you trying to do:

I am trying to compile foo.c and your compiler has ruined my life by deleting all 
my files.

What you expected to happen:

The program works in many other C compilers, so should compile with no issue.

What actually hapened:

/ was deleted while the compiler printed "hahaha" many thousands of times.

Here is a small self contained file which reproduces the issue.

In general each bug fix or change should add a test file which triggers the bug.

Commit messages

General style:

Fix issue #3 post increment.

Post increment had a bug where it decremented instead of incremented.

Commits can be squashed to increase clarity.

Memory management

The compiler assumes a conservative garbage collector. For now, the header is stubbed out. This simplifies the code.

Useful Links

c's People

Contributors

andrewchambers avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.