On 09/12/14 02:45, deadalnix wrote:
On Monday, 8 December 2014 at 15:44:55 UTC, Stefan Koch wrote:
I want to do a C backend first.
Building an LLVM Backand out of that is a small step.

There is already a very popular C to C compiler out there. It is
called cat, and come out of the box with any UNIX like system.

I know it was meant as a joke, but I couldn't resist nitpicking.

When Stroustrup started out with an OO successor to C, he wrote a preprocessor that would convert his new syntax to C, to be passed to a C compiler. When the language started to evolve, that proved insufficient, and he wrote CFront, a C++ to C compiler.

He defines the difference between a preprocessor and a compiler along these lines: With a compiler, any and all compilation errors need to be caught by the front end. If the front end accepted your program, and the back end fails to compile it, it is, by definition, a compiler bug.

As such, cat (nor its close neighbor, "tac | tac"), are not a compiler, since it does not catch compilation errors.

Sorry for the nitpick.
Shachar

Reply via email to