4 ms·
I agree with you. In fact I would say understanding compilers is really pretty easy. They are some of the most well researched and documented subjects (in CS) o
by grep_it 6y ago
I agree with you. In fact I would say understanding compilers is really pretty easy. They are some of the most well researched and documented subjects (in CS) out there. Almost all compilers are going to follow a similar structure of lex -> parse -> pass0 -> passN -> generation.
The challenge these days seems to be in the passes which can become numerous and complex.
- chrisseaton 6y ago> They are some of the most well researched and documented subjects (in CS) out there. Hmm this is the first time I've ever seen someone say this! I would say compilers are famously badly documented part of computer science, with many essential techniques basically not written down anywhere but buried in code, and passed through oral history from senior to intern over the years! It's a real problem.
- jcranmer 6y agoI'd say both sides are true. The theoretical aspects of compilers are quite well-understood, and for pretty much every pass or analysis in the compiler, I could go and rustle up a citation of a paper or a talk or a book or what have you that explains the theory of the algorithm. On the other hand, actual code brings up issues that aren't easily handled in the theoretical framework, and the adjustments necessary to make it work well in practice generally are in the vein of the-code-is-the-documentation.
- phillipcarter 6y agoThat's not quite the whole picture. Several industrial compilers for languages used by people for work are made by people who recognize that tooling is important. So the compiler is also a service or set of services with (depending on how you think about it) a database of information to query. It significantly increases the scope of the compiler and adds another dimension of performance and reliability to the system. For example, it may be a good idea to allocate a bunch of memory up front as a part of batch compilation to process some stuff. In a tooling scenario that can be a bad idea unless that large allocation routine is done in a way that the memory is pooled for the many, many requests it's going to get over its lifetime.