Re: Any book recommendation for writing a compiler?
Thanks for those references! I'm also interested in looking through those. I had computation theory in college a long time ago but never took a compiler course. On 11/7/2017 5:26 AM, Tony wrote: Author Allen Holub has made his out-of-print book, Compiler Design in C, available as a free pdf download: http://holub.com/compiler/ And Torben Mogensen is doing the same with his more recent Basics of Compiler Design: http://www.diku.dk/~torbenm/Basics/ --- This email has been checked for viruses by AVG. http://www.avg.com
Re: Any book recommendation for writing a compiler?
Author Allen Holub has made his out-of-print book, Compiler Design in C, available as a free pdf download: http://holub.com/compiler/ And Torben Mogensen is doing the same with his more recent Basics of Compiler Design: http://www.diku.dk/~torbenm/Basics/
Re: Any book recommendation for writing a compiler?
On Tuesday, 7 November 2017 at 01:30:14 UTC, Basile B. wrote: On Saturday, 4 November 2017 at 20:28:17 UTC, Ola Fosheim Grøstad wrote: On Saturday, 4 November 2017 at 15:51:30 UTC, Basile B. wrote: People who say that after reading the dragon book, you will program your own programming language are lying. Well, you most certainly can write your own programming language after reading about 30% of the dragon book, but I think you can find easier books to get started these days. I've just read the dragon book. let's write a compiler A basic compiler is not so complicated. Just align the semantics of your language to an existing one and use that language as your intermediate representation (C, D, Go whatever).
Re: Any book recommendation for writing a compiler?
On Saturday, 4 November 2017 at 20:28:17 UTC, Ola Fosheim Grøstad wrote: On Saturday, 4 November 2017 at 15:51:30 UTC, Basile B. wrote: People who say that after reading the dragon book, you will program your own programming language are lying. Well, you most certainly can write your own programming language after reading about 30% of the dragon book, but I think you can find easier books to get started these days. I've just read the dragon book. let's write a compiler https://imgur.com/1pFeat8 ;-)
Re: Any book recommendation for writing a compiler?
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? A few more resources on writing a frontend (lexer, syntactic and semantic analizer). http://thinkingeek.com/gcc-tiny/ Tells how to create a GCC frontend for a Pascal-like language, tiny. Can be useful since you can look how it applies to a real dfrontend in GDC. https://ruslanspivak.com/lsbasi-part1/ Very clear tutorial on writing a Pascal interpreter in Python. Very beginner friendly, but not complete yet. http://buildyourownlisp.com/contents It is an online book that teaches C by writing an interpreter for a Lisp-like language, lispy. The code can be easely translated to D. If you want you can also look at some haskell books. A simple parser is one of the standard projects used to teach haskell.
Re: Any book recommendation for writing a compiler?
On Saturday, 4 November 2017 at 15:51:30 UTC, Basile B. wrote: People who say that after reading the dragon book, you will program your own programming language are lying. Well, you most certainly can write your own programming language after reading about 30% of the dragon book, but I think you can find easier books to get started these days. For more advanced stuff I would recommend downloading power points or notes from university courses on master or ph.d. level. The books and articles on more advanced stuff are often heavy on formalisms and difficult to digest for most programmers.
Re: Any book recommendation for writing a compiler?
On Thursday, 2 November 2017 at 14:24:01 UTC, Basile B. wrote: On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? You don't need to read books to write a compiler, a bit of theory from "here or there" will be enough, particularly if you start from scratch, there's almost no chance that you ever touch the more edgy things (something like theory of types maybe ). A few ones written in D (sorted by URL length): - https://github.com/dlang/dmd - https://github.com/BBasile/yatol - https://github.com/higgsjs/Higgs - https://github.com/VoltLang/Volta - https://github.com/beast-lang/beast-dragon Otherwise a subreddit that's not been quoted yet: - https://www.reddit.com/r/ProgrammingLanguages/ and their homepage listing a few projects from people who have started "the journey": http://www.proglangdesign.net/ Dr Assembly what i mean can be illustrated by this: You see this https://github.com/matijapretnar/eff ? http://www.eff-lang.org/ ? People who say that after reading the dragon book, you will program your own programming language are lying.
Re: Any book recommendation for writing a compiler?
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? You don't need to read books to write a compiler, a bit of theory from "here or there" will be enough, particularly if you start from scratch, there's almost no chance that you ever touch the more edgy things (something like theory of types maybe ). A few ones written in D (sorted by URL length): - https://github.com/dlang/dmd - https://github.com/BBasile/yatol - https://github.com/higgsjs/Higgs - https://github.com/VoltLang/Volta - https://github.com/beast-lang/beast-dragon Otherwise a subreddit that's not been quoted yet: - https://www.reddit.com/r/ProgrammingLanguages/ and their homepage listing a few projects from people who have started "the journey": http://www.proglangdesign.net/
Re: Any book recommendation for writing a compiler?
On Thursday, 2 November 2017 at 03:55:27 UTC, Michael V. Franklin wrote: On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I found this to be quite helpful: http://llvm.org/docs/tutorial/ Specifically the Kaleidoscope tutorial. Mike If you are interested in using LLVM my little project might be helpful: https://github.com/igor84/summus
Re: Any book recommendation for writing a compiler?
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I found this to be quite helpful: http://llvm.org/docs/tutorial/ Specifically the Kaleidoscope tutorial. Mike
Re: Any book recommendation for writing a compiler?
On 01/11/2017 11:13 PM, Jonathan M Davis wrote: On Wednesday, November 01, 2017 20:53:44 Dr. Assembly via Digitalmars-d- learn wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? Well, if you're looking to actually buy a book, this is the one that I used in college and it was good: https://www.amazon.com/Compiler-Construction-Principles-Kenneth-Louden/dp/0534939724/ref=sr_1_1?ie=UTF8=1509574006=8-1=louden+compiler Out of stock: https://www.thriftbooks.com/w/compiler-construction-principles-and-practice_kenneth-c-louden/263600/#isbn=0534939724 However, the one that folks generally mention is the "dragon book:" https://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811 https://www.thriftbooks.com/w/compiladores-principios-tecnicas-y-herramientas_alfred-v-aho/248872/#isbn=0201100886 I haven't read it though, so I can't comment on its contents, just that it's commonly recommended. Neither book is exactly cheap though. There may be some good online resources for learning about compilers, but I don't know them. However, if you're really serious about it, you'll probably want to read a textbook, since it's the sort of area where a good theoretical background to things can be quite useful. Certainly, at minimum, you're going to want to know the differences between things like a lexer and parser and what an abstract syntax tree is. - Jonathan M Davis I'd call it cheap ;) It isn't too bad grounding in everything, but doesn't branch out much (which is fine) and yeah invest in the hard cover version, its well worth it.
Re: Any book recommendation for writing a compiler?
On Wednesday, 1 November 2017 at 20:56:22 UTC, Dr. Assembly wrote: On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I'd like something on back-end too, for example, code generation, convert the AST to actual assembly/machine code. On my research I found mostly front-end related stuff, like recursive descent parser. Look at this book: https://www.t3x.org/reload/index.html Some cool open source languages: * Elena programming language: https://github.com/ELENA-LANG/elena-lang * DotNetPeLib: https://github.com/LADSoft/DotNetPELib * OrangeC/C++ compiler: https://github.com/LADSoft/OrangeC I have some cool projects: * A simple C compiler that generates a EXE/DLL: https://gist.github.com/bencz/79d4738afe962b5479d1 * CoffLib ( a lib to generate x86 EXE/DLL in .Net ) : https://github.com/bencz/CoffLib * Zinnia-lang: https://github.com/bencz/Zinnia-lang * dncpp: https://github.com/bencz/dncpp * Pythonish-Compiler: https://github.com/bencz/Pythonish-Compiler
Re: Any book recommendation for writing a compiler?
On Wednesday, November 01, 2017 20:53:44 Dr. Assembly via Digitalmars-d- learn wrote: > Hey guys, if I were to get into dmd's source code to play a > little bit (just for fun, no commercial use at all), which > books/resources do you recommend to start out? Well, if you're looking to actually buy a book, this is the one that I used in college and it was good: https://www.amazon.com/Compiler-Construction-Principles-Kenneth-Louden/dp/0534939724/ref=sr_1_1?ie=UTF8=1509574006=8-1=louden+compiler However, the one that folks generally mention is the "dragon book:" https://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811 I haven't read it though, so I can't comment on its contents, just that it's commonly recommended. Neither book is exactly cheap though. There may be some good online resources for learning about compilers, but I don't know them. However, if you're really serious about it, you'll probably want to read a textbook, since it's the sort of area where a good theoretical background to things can be quite useful. Certainly, at minimum, you're going to want to know the differences between things like a lexer and parser and what an abstract syntax tree is. - Jonathan M Davis
Re: Any book recommendation for writing a compiler?
On 11/01/2017 01:53 PM, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I haven't read it but one compiler bible is "the dragon book": https://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811 You should also watch Walter's presentation on dmd internals: http://dconf.org/2016/talks/bright.html Ali
Re: Any book recommendation for writing a compiler?
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I'd like something on back-end too, for example, code generation, convert the AST to actual assembly/machine code. On my research I found mostly front-end related stuff, like recursive descent parser.
Any book recommendation for writing a compiler?
Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out?