tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Is TCC good learning material?


From: Stefanos Baziotis
Subject: Re: [Tinycc-devel] Is TCC good learning material?
Date: Tue, 3 Sep 2019 03:08:12 +0300
User-agent: SquirrelMail/1.4.22 [email.uoa.gr]

>
> Stick with it, it's really not that hard.  Open tccgen.c and start reading
> from bottom to top.  You want to be equipped with an editor/GUI that
> provides quick jumping to definitions of functions you happen to come
> across while reading.
>
> You have to keep in mind that TCC is a single pass compiler that generates
> code during parsing, which influences various ways of doing things, but in
> a way it also simplifies TCCs data structures: there's not much internal
> state except the symbol table (split between the ELF symbol table and the
> TCC one), the expression stack, the symbol unwind stack (for scopes) and
> the implicit function call stack for parsing the various recursive C
> constructs.
>
> Also, to understand the inner workings of stuff it helps to see the thing
> in action under control of a debugger, so choose a short C file and see
> what TCC does with it while compiling.
>
> Of course, TCC also contains the preprocessor (tccpp.c) and ELF linker
> (tccelf.c), but they're all controlled from and called by routines in
> tccgen.c.  (As is the various architecture backends in e.g. x86_64-gen.c).
>

Great, thanks! I'll try to update the doc as I learn. In my opinion,
it's fairly minimal.

Kind regards,
Stefanos




reply via email to

[Prev in Thread] Current Thread [Next in Thread]