I have already sent a tutorial to rempas to make a simple compiler using parser generator Coco/r, but there is one extremely simple tutorial to learn writing compilers from scratch: Let's build a compiler by Jack Crenshaw Let's Build a Compiler (iecc.com) <https://compilers.iecc.com/crenshaw/> . It is Pascal and Motorola 68000 target based. Do not discard it as obsolete. Pascal is a very readable programming language, and MC 68000 has a quite good instruction set.
On Sat, Jan 29, 2022 at 11:11 AM Christian Jullien <eli...@orange.fr> wrote: > 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...@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 Από s...@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't > > even want to create an intepreter to begin with. So this has nothing to do > > with what I want to make. Unless you are referring to the frontend so in > > this case, It will probably be a good idea to read this book. Or maybe I > > should make an intepreter in the end? Hmmmmm.... > > > > > > It's interpreters all the way down (what do you think CPUs do with machine > > code? They interpret it). Also, if you have parsed code into a form you > > can interpret, you have enough information to generate machine code. > > > > -spc > > > > _______________________________________________ > > Tinycc-devel mailing list > > Tinycc-devel@nongnu.org > > https://lists.nongnu.org/mailman/listinfo/tinycc-devel > > > > I 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 list > > Tinycc-devel@nongnu.org > > https://lists.nongnu.org/mailman/listinfo/tinycc-devel > > -- > -- sibian0...@gmail.com > -- Développeur compulsif > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel >
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel