4 ms·
Author here. These days I'm writing a new C compiler (https://github.com/rui314/chibicc https://github.com/rui314/chibicc) from scratch again to write a book ab
by rui314 7y ago
Author here. These days I'm writing a new C compiler (https://github.com/rui314/chibicc https://github.com/rui314/chibicc) from scratch again to write a book about compilers.
Since I'll be using the new one as a reference implementation for a book, and the book is intended to be for beginners, I put as much effort as I can into improving the readability of the code. In particular, not only the head of the repository but every commit in the repo should be readable, so that readers can easily understand how each feature is implemented. I believe I'm doing a good job keeping it clean so far. (Actually in order to keep the commit history clean, I continue rewriting commit history and doing `git push -f`, but that should be fine because the purpose of publishing the repo is not for co-development but for sharing a reference implementation.)
chibicc does not have a C preprocessor, but except that it can compile itself already, so if you are interested, you can take a look.
- walty8 7y ago(Actually in order to keep the commit history clean, I continue rewriting commit history and doing `git push -f`, actually I wonder if you might consider to maintain another clean repository. So there is a raw repository to record every real history, and a clean repositiory to for better reading? Because sometimes the raw history could be interesting too.
- rui314 7y agoI haven't considered that but I think that's hard to do for technical reasons. New commits are made on top of a clean history, so there's no single history of "raw" commits but they are intermingled.
- saagarjha 7y agoMaybe you can disable git gc and allow for readers to grab a copy of your repository’s full reflog?
- CogitoCogito 7y agoI would recommend you keep doing it the way you are. You are working on an educational exposition and choosing commits as part of that. You should take the position that the best judge of proper presentation. That said you could always turn off gc if some people want it, but I wouldn't put any more than a token effort into keeping that history.
- meuk 7y agoHow's it coming along? Will there be an English translation available? Actually, I just tried to translate part of the book (the whole book is 'too big to translate') with Google translate, and the translation looks of remarkably high quality compared to what I'm used to from Google translate. I would love to see a similar book/project for a linker and assembler.
- reacweb 7y agoEach time I use google translate from chinese to english, I am also surprised by the good quality. French to english is really bad in comparison.
- rui314 7y agoI will translate it to English. Be wary of the machine translation -- using the neural network they learned how to write surprisingly natural sentences but that doesn't mean their translation is correct.