Third rebase (2014-11-20 by Bas vd Berg)

The C2 compilers is based both on LLVM and on Clang. This is a great platform to build a compiler on. The first C2 compiler was based on version 3.2 of both and today marks the next step as it's now rebased on 3.5. This brings a newer C standard and more checks. I would like to thank both the Clang and LLVM team for their great effort!

Working on the parser (2014-07-24 by Bas vd Berg)

The C2 compiler is not fully complete yet, but some parts are finally nearing something that is almost close to nearly done. The Parser component is one of those. With the addition of parsing of Array and Field Designator Inits (.x = 10, [10] = 2, etc), only a few things remain, namely casts and bitfields. Follow the discussion on the forum if you're interested.

generating dependencies (2014-05-12 by Bas vd Berg)

One advantage of having no header files, is that symbols (functions, variables, etc) are only defined in one place. This allows tools to generate good dependencies. In language with header files, it's always the question of where to place the dependency: the header, the c-file or both? In C2, the compiler can generate a full-dependency file. No other tools are needed and the results can be trusted. If you're interested in some of the results, check the forum post.

Type-system update (2014-03-15 by Bas vd Berg)

Checking types in a C-like language is not very straightforward. A lot of weird things and a lot of decisions to make. So it took me almost 6 months to finish the update I push today. This update of 155 patches enables the type checking system to check integer literals and built-in types completely. Floating points and pointer stuff only has rudimentary checking, but that's a lot easier now the basic system is in place. So hopefully that'll only take a month or so..

If you're interested in the capabilities, the best place to look is the unit-tests directory (test/) and for discussions, check the forum.

A New Year.. (2014-01-01 by Bas vd Berg)

In a few days, the C2C GitHub archive celebrates its first birthday. Looking back at the past year, C2C has reached some milestones: So it's definately possible to develop some C2 code and use c2c to check it. This should give a feeling of developing in C2. Looking forward to 2014, plans include: I especially like the c2reto tool, since it allows drag 'n drop reordering of functions, types and variables in and between files. It will also show dependencies between packages.

Implementing C2 (part 2) (2013-09-07 by Bas vd Berg)

Looking at the frequency of these posts, you'd think work on C2 stopped. Nothing could be further from the truth. The Github archive is steadily growing. Most recently was the complete rewrite of the Type system and the addition of a test framework. With these two things in place the Parser and Semantic Analysers will definitely get more mature. The current state is that the Parser is almost parsing the full syntax (there are just some cornercases and some error handling left). The Analyser is detecting a lot of errors already; next on the list is detection of unused Types/Functions/Vars and uninitialized variables. The C-code generator is basically working, but doesn't produce correct C code a 100% of the time. The IR code generator is still in it's infancy. The AST (abstract syntax tree) does hold all the information it needs, so nothing is blocking there except time to implement. If you have any ideas/questions please use the forum. Happy hacking!

Implementing C2 (2013-04-11 by Bas vd Berg)

After the Fosdem presentation, the GitHub archive got 40+ followers, so I think that part was succesfull. I wanted to get more functionaly in as soon as possible after that. The biggest feature that entered the stage was code analysis; checking for errors/warnings in the code. This part really worked out well I think. It's in no way finished, but the basis is there. I was able to re-use a lot of Clang functionality for this (Great job guys!). Additionally there have been many minor changes (changing the package operator from :: to . (dot), etc). The next big thing will be type checking (eg int a = "hello";) and after that the real code-generation can begin. I haven't looked into LLVM IR code generation beyond a few hello-worlds, so any help translating the AST to the LLVM IR code is welcome. If you're interested, follow the forum or the Git archive.

Preparation for FOSDEM '13 (2013-01-10 by Bas vd Berg)

My proposal for a 15 minute lightningtalk at Fosdem '13 has been accepted! Because I want to have this website and Git archive ready by then, I have some work to do. I also started working even more on C2 since then. The current state of it is than it parses almost the full syntax and translates a subset into the AST (Abstract Syntax Tree). I just started on code generation. For those wanting to read more about the language, I've added a PDF design document (in the top bar under Design). Hopefully my lightning-talk will spark the interest of some fellow developers...

(more info on FOSDEM '13 can be found here)

The beginning... (2013-01-04 by Bas vd Berg)

In the beginning of June 2012, I was looking (as always) for a new pet-project. I wanted to create my own compiler for a long time, but the effort always seemed to big and the goal never really worthy. Then I got an idea to improve C, because I really like that language, but found the header files bothersome. After writing some compiler mockups of my own, I found out that parsing C is really hard. So I started playing around with llvm/clang and suddenly, and the whole effort of writing a compiler looked much easier. So I started modifying clang to re-use its Lexer and C2 was born.