C Compiler from Scratch
21–30 of 68 posts
Re: C Compiler from Scratch
#22I feel that many introductions to scanning and parsing are based on old techniques when memory were scarce. In those times storing your files in memory, was simply impossible. But we live in times where we have gigabytes of ram and there are not many projects that could not be read into memory. (Tell me about a project that has a gigabyte of source files, please.) So, why not assume your input to be stored in a strin…
Here's one, apparently: http://lists.llvm.org/pipermail/cfe-dev/2019-October/063459....
Re: C Compiler from Scratch
#23This is fantastic work. I believe learning to write a compiler is similar to learning a functional programming language. It completely changes the way you approach problems. I'm curious why BNF was chosen vs EBNF. I'm new to parsers and grammar. Isn't EBNF easier/simpler to write complex rules?
Compiler Construction Using Java, JavaCC, and Yacc Book by Anthony J. Dos Reis Uses similar approach with much more details on theory and implementation. I learned so much from this book. It teaches you to write a hand written compiler and by using tools like javacc/yacc as well. But I really love how the author explains the knots and bolts on creating a hand written compiler. Get this book if you're interested in cr…
Any Idea what is the actual state?
Re: C Compiler from Scratch
#24This might be relevant A Retargetable C Compiler: Design and Implementation by David Hanson and Chritopher Fraser https://www.amazon.com/Retargetable-Compiler-Design-Implemen... Written in a literate programming style.
Re: C Compiler from Scratch
#25I feel that many introductions to scanning and parsing are based on old techniques when memory were scarce. In those times storing your files in memory, was simply impossible. But we live in times where we have gigabytes of ram and there are not many projects that could not be read into memory. (Tell me about a project that has a gigabyte of source files, please.) So, why not assume your input to be stored in a strin…
> Tell me about a project that has a gigabyte of source files, please. Here's one, apparently: http://lists.llvm.org/pipermail/cfe-dev/2019-October/063459....
Re: C Compiler from Scratch
#26I'm learning from the Compiler course offered freely from Stanford [0] and the dragon book. I still feel great about it. And I think this GitHub project submitted will be an excellent practical source for analysis of how real world compiler might looks like from its beginning. [0]: https://lagunita.stanford.edu/courses/Engineering/Compilers/...
> And I think this GitHub project submitted will be an excellent practical source for analysis of how real world compiler might looks like from its beginning. If you want to understand how people build production (or even prototype) compilers, this is not going to be a good source. Most compiler courses are going to take you from a compiler from the frontend through the middle-end and into the backend. But, if you we…
Re: C Compiler from Scratch
#27I feel that many introductions to scanning and parsing are based on old techniques when memory were scarce. In those times storing your files in memory, was simply impossible. But we live in times where we have gigabytes of ram and there are not many projects that could not be read into memory. (Tell me about a project that has a gigabyte of source files, please.) So, why not assume your input to be stored in a strin…
To be totally fair it was the biggest inefficient coding mess I've seen. I still regret not scanning and keeping the customerlist because if I did i'd be deep in that business right now making bank.
Re: C Compiler from Scratch
#28I'm learning from the Compiler course offered freely from Stanford [0] and the dragon book. I still feel great about it. And I think this GitHub project submitted will be an excellent practical source for analysis of how real world compiler might looks like from its beginning. [0]: https://lagunita.stanford.edu/courses/Engineering/Compilers/...
I want to dive into creating a language / compiler finally but I might do it with the Writing an Interpreter / Compiler series in Golang. Just so I can dive in and try to digest it all. Course I always heard of the dragon book and have wanted it since.
I wouldn’t read it except out of historical interest - it’s not how we build compilers anymore, with its super-heavy emphasis on parsing and syntax-directed translation.
Re: C Compiler from Scratch
#29How difficult would it be to implement in comparison to a compiler ?
Where should I start looking ? (I want to build a compiler at some point but I want to get my feet wet building a simple language parser first)
Thanks in advance