nwcc 0.6.6 review
Downloadnwcc is a small C compiler for Unix systems that I wrote in my freetime, for fun and to prove to myself that I could
|
|
nwcc is a small C compiler for Unix systems that I wrote in my freetime, for fun and to prove to myself that I could. I started the project in August 2003, but because I had a job and a life and a few other hobby code projects, it took me until autumn 2005 to make it work with various constructs of the C language.
So what new does nwcc bring to the table? Most importantly, new code: I wrote everything from scratch - including the lexer, parser and backend.
The code of nwcc is written in C, is currently around 25.000 lines in size, and I'm releasing it under the BSD license.
This release is not intended for serious use, but at least nwcc is strong enough to compile itself (the result of which can compile nwcc as well) and should thus be capable of dealing with at least some small programs. There are still some things missing/broken, but things are improving almost every day (I upload my changes to SF whenever I add/fix something of interest.)
Here are some key features of "nwcc":
There are some C language features missing; Most notably support for floating point, bitfields and a few other things. Many other things are broken (there are probably bugs in pretty much every language feature implemented by nwcc)
There are no features a power developer used to established mainstream compilers would consider interesting, yet (apart from, maybe, the stack protection feature.) Sorry. There is nothing beyond plain dumb compilation; No support for creating shared libraries, no support for debugging or profiling, no nothing
There is currently only a backend for 80x86 processors (which generates code for the NASM Netwide Assembler and works on Linux, FreeBSD and OpenBSD)
There is absolutely no optimization, meaning the generated code is very slow compared to the output of established compilers. I will work on this soon, but you should understand that my primary concerns right now are code correctness and portability rather than speed (it's hard enough to make slow code work!)
It takes a lot of work to get even a subset of the C language to compile, so the fact that something is missing or done wrong in nwcc does not mean that I don't care about that particular area of the C language or compiler design; It only means that I haven't gotten around to doing it right, or indeed at all, yet.
What's New in This Release:
· This release adds initial support for cross-compilation between all supported platforms.
· Unlike some other cross-compilers, nwcc does not need to be built for a particular target, and allows you to choose architecture and ABI by using command line options.
· Various severe bugs have also been fixed.
nwcc 0.6.6 search tags