|
From: | Samir Ribić |
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: | Sat, 29 Jan 2022 11:41:07 +0100 |
_______________________________________________I suggest you start with something simple:
A language that implement 4 arithmetic integer operations, has integer variables, allows to define functions and includes print function as library function.
Chose the syntax you like and start to write you own compiler that generate intermediate internal code, then choose a backend (for example C) that generates code corresponding to your intermediate code.
You’ll learn of lot of things and you’ll get 80% of the knowledge you’ll need to write serious things.
This globally how works my Lisp compiler from Lisp files up to standalone executable.
See https://en.wikipedia.org/wiki/OpenLisp#Compiler
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of ian
Sent: Saturday, January 29, 2022 10:43
To: rempas via Tinycc-devel
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?
Hi
One thing or the other :
- you wanna learn asm or algorithmics, and it's not the best place; but you obviously need to have to know them a "few",
- or, you already know how to code something in ASM, and then the suggested book about how to make an interpreter is the good starting point for you.
Rgds
Le 29/01/2022 à 10:08, rempas via Tinycc-devel a écrit :
29 Ιαν 2022, 03:20 Από sean@conman.org:It was thus said that the Great rempas via Tinycc-devel once stated:I would advice you to start with this https://craftinginterpreters.com/contents.html first.The rest will follow before you know it.Thanks! However, I don't understand how this will help me. I mean, I don'teven want to create an intepreter to begin with. So this has nothing to dowith what I want to make. Unless you are referring to the frontend so inthis case, It will probably be a good idea to read this book. Or maybe Ishould make an intepreter in the end? Hmmmmm....It's interpreters all the way down (what do you think CPUs do with machinecode? They interpret it). Also, if you have parsed code into a form youcan interpret, you have enough information to generate machine code.-spc_______________________________________________Tinycc-devel mailing listTinycc-devel@nongnu.orghttps://lists.nongnu.org/mailman/listinfo/tinycc-develI don't know if I'm that stupid but I really don't understand. I know that the CPU interprets the instructions but an interpreter will use a programming language to interpret. For example, the following statement:`println("Hello from my lang: {}", "BestLang")`will be translated to (suppose the interpreted is written in C) and then be executed:`printf("Hello from my lang: %s", "BestLang);`So how is this going to teach my assembly and how the instructions are represented in binary? The book specifically says that it won't work with teaching assembly. The interpreted is a binary that takes source code and executes it. It doesn't create a binary. So I really don't understand what's going on here..._______________________________________________Tinycc-devel mailing listTinycc-devel@nongnu.orghttps://lists.nongnu.org/mailman/listinfo/tinycc-devel--
-- sibian0218@gmail.com
-- Développeur compulsif
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Prev in Thread] | Current Thread | [Next in Thread] |