tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Can a biggener (and idiot) like me read and understan


From: rempas
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 22:05:36 +0100 (CET)

28 Ιαν 2022, 21:25 Από niklasro@gmail.com:

> I tried to read the Tiger Book with examples. I tried to learn Bison. I tried 
> to learn Lemon Parser. I could not write the grammar for a for-loop. I don't 
> know if that's because if stupid, if it wasn't well explained or if it's 
> difficult.
>
Don't say that! You don't seem to be stupid to me and the fact that you kept 
trying shows that your can do hard work with is more important the been genius 
and lazy (like some people are).

> What I could learn from was to take the instruction sheet for MIPS assembly 
> and find out how statements in C can translate to assembly. That was easy to 
> learn. What a real compiler will generate is always 5 times more than what 
> the instruction manual says it should translate to. I tried with GCC and a 
> MIPS compiler, looked at the generated assembly which was very different from 
> what I could run directly from e.g. the MARS MIPS environment by writing it 
> by hand.
>
> I'm out on deep water but this was my experience with trying to learn. I 
> found that TCC is very good for learning and trying ideas.
>
> /Niklas
>
TCC is probably heaven compared to GCC or probably anything else. However, I'm 
not so worried about how C translates to assembly but about the structure of 
the header file (sections, sectors, addresses, offsets etc.) and how the 
instructions translate to binary (does the CPU uses GCC or NASM syntax under 
the hood? Or maybe none of them)? This will be a huge pain in the ass to do 
this way. It will require hours and hours just to properly learn a few of them. 
So it can't be, there must be a better way to do this in 2022...



reply via email to

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