|
From: | Niklas Rosencrantz |
Subject: | Re: [Tinycc-devel] Can a biggener (and idiot) like me read and understand TCC's backend so I can create my own frontend with it? |
Date: | Fri, 28 Jan 2022 20:25:08 +0100 |
26 Ιαν 2022, 22:55 Από niklasro@gmail.com:
> I'm not an expert C programmer. I could find my way, read and learn from the TCC source code. It reminded me of reading the source of SASH (the stand-alone shell) which is readable compared to DASH for example.
>
> 2. What I would do to learn more but it's not guaranteed to work
>
> a) I would try and learn how statements (in C) translate to assembly for a target platform. Maybe start with ARM or MIPS that is supposed to be easier than x86 asm.
>
> b) I would try and write a disassembler because I heard it's a good exercise.
>
> My experience is that compilers or how to write an interpreter is not a learn-by-doing ability. I would need to read and practice a lot before trying to do it.
>
> /Niklas
>
Thanks you! Yeah, trying to test things yourself is a way to learn but apart from been very very hard, inappropriate and annoying to do, this is another way. You see, let's say that you want to see how a statement translates to assembly from C ok? Now, let's say that you use GCC for that (which produces more bloated code than TCC hence why I picked it for the example) to see how it translates C code to assembly. Now the problem with this is that, why should we take the way it does it as "the right way?" Maybe the way GCC does it is not the best possible way or maybe there are better practices that have been found through the years. So I think I will ultimately waste my time and challenge my patience doing it this way.
[Prev in Thread] | Current Thread | [Next in Thread] |