A
Anton Gavrilov
Hi all,
I seek your advice on where to start if I want to write a compiler for a
toy C-like language I invented (or, rather, am in the process of
inventing). Yes, yes, I know I'm crazy and the very idea is
brain-damaged and all that. Chances are I will lose interest long before
I reach break-even, but it doesn't hurt trying, does it?
I'm a C addict reluctant to switch to C++, partly because I can't fully
grok (and accept) the OOP paradigm. Nevertheless I like C++'s arguable
improvements such as overloading of functions and operators, references,
const types etc. I also miss Pascal's way-less-cryptic typedefs and
consistent array types.
I suppose that rather than writing my experimental compiler from scratch
it might be a better idea to take an existing one and hack it towards my
notion of 'the ideal multi-purpose language'. I had some experience
with QuakeC (a byte-code compiler for the game Quake) so I know what a
very simple compiler looks like, but things like parsing and handling of
composite data types and generation of x86 machine code are still beyond
my understanding.
I have taken a look at GCC source once and was startled to death.
Obviously it's a highly advanced, extendible and portable compiler and
this implies quite a lot of unnecessary complexity.
Is there something like 'The Art of Writing Compilers for Dummies?'? Is
there a simple C compiler somewhere for which source is available under
a GPL-compatible license?
Any help is appreciated.
BR,
Anton 'Tonik' Gavrilov
I seek your advice on where to start if I want to write a compiler for a
toy C-like language I invented (or, rather, am in the process of
inventing). Yes, yes, I know I'm crazy and the very idea is
brain-damaged and all that. Chances are I will lose interest long before
I reach break-even, but it doesn't hurt trying, does it?
I'm a C addict reluctant to switch to C++, partly because I can't fully
grok (and accept) the OOP paradigm. Nevertheless I like C++'s arguable
improvements such as overloading of functions and operators, references,
const types etc. I also miss Pascal's way-less-cryptic typedefs and
consistent array types.
I suppose that rather than writing my experimental compiler from scratch
it might be a better idea to take an existing one and hack it towards my
notion of 'the ideal multi-purpose language'. I had some experience
with QuakeC (a byte-code compiler for the game Quake) so I know what a
very simple compiler looks like, but things like parsing and handling of
composite data types and generation of x86 machine code are still beyond
my understanding.
I have taken a look at GCC source once and was startled to death.
Obviously it's a highly advanced, extendible and portable compiler and
this implies quite a lot of unnecessary complexity.
Is there something like 'The Art of Writing Compilers for Dummies?'? Is
there a simple C compiler somewhere for which source is available under
a GPL-compatible license?
Any help is appreciated.
BR,
Anton 'Tonik' Gavrilov