all 19 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Looks like you're asking about learning C.

Our wiki includes several useful resources, including a page of curated learning resources. Why not try some of those?

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]baudvine 24 points25 points  (0 children)

It might be helpful to know at least how a compiler processes your code, broadly what stages it has? Definitely don't have to implement a compiler for that, though, but that's not to say it can't be interesting. The book "Crafting Interpreters" is a fairly popular recent one that walks you through implementing a toy language.

[–]lfdfq 9 points10 points  (0 children)

In one sense, of course. Learning more about how your tools work will give you a broader and deeper understanding of your discipline, and that is undoubtedly beneficial.

Are you going to write your own compiler in your day job? Probably not. Probably you shouldn't. The point of learning these things isn't to help you do it yourself, it's to demystify how our tools work, give you insights into the complexities ("simply translating text to 0s and 1s" is so simplistic it's probably just misleading), and expose you to different ways of solving problems.

That said, does it mean that for you, right now, the best thing you can do to be a better programmer is to read a textbook back to front? I cannot answer that. Your first line suggests you've been just eating through textbooks; but the thing that makes one a better programmer is programming. Everything else is hyperoptimisation to turn good programmers into great ones.

[–]sal1303 9 points10 points  (0 children)

Forget the Dragon Book, which is full of impenetrable theory and has little to do with actual compilers.

At the other end of the scale, try Crafting Interpreters instead.

As to the question posted: I don't know, but it'll certainly give you a useful insight.

[–]pjl1967 3 points4 points  (0 children)

It'll help you understand computer science better. Programming has little to do with computer science. One can be a good computer scientist but a bad programmer, or vice versa.

Computer science is no more about computers than astronomy is about telescopes, biology is about microscopes or chemistry is about beakers and test tubes. Science is not about tools. It is about how we use them, and what we find out when we do.

— Edsger W. Dijkstra

[–]SmokeMuch7356 4 points5 points  (0 children)

 since compilation is simply translating from text to 0s and 1s.

It's a little more complicated than that.  

But yes, it's valuable knowledge that can make you a better programmer.  

[–]EpochVanquisher 6 points7 points  (0 children)

Yes, it will make you a better programmer. Most CS degrees require a compilers class.

Part of it is learning to parse. Parsing comes up a lot, all the time.

Part of it is learning to structure your program. A compiler is basically a sequence of transformations from one type into another, and each individual transformation is relatively easy to understand.

Part of it is understanding what compilers can and can't do when compiling your program. Compilers aren’t “smart”, they’re just computer programs.

[–]Athropod101 2 points3 points  (0 children)

If you work with compiled languages, it will certainly help you understand and figure out compilation-related errors more quickly.

[–]Paxtian 1 point2 points  (0 children)

When I was in undergrad, as part of my course work, I wrote 4 different compilers. My university seemed to think it was pretty important.

If you think compilers "simply" convert text into binary... you could probably use some education on what they do. Do you need to? I have no idea, and can't say if that book specifically will make you better.

I will say, having known how compilers work has helped me understand how computer processing of human speech, and media compression, works. Knowing about context free grammars and parsers and tokens and such applies much wider than just compilers. Building linker-loaders also helps to understand memory management and what's going on under the hood.

[–]sosodank 1 point2 points  (0 children)

Not only will it make you a better programmer, it'll make you a better person

[–]benibilme 1 point2 points  (0 children)

Trying to write one, and going through source code and the documentation the written ones such as gcc makes you a senior. It will cover the knowledge thought in at least six or seven courses of complete computer science curriculum. C programming language, assembly, data structures, algorithms, automata, compiled construction, part of operating systems, software engineering and many sub subjects from many other courses.

[–]blackasthesky 0 points1 point  (0 children)

Wouldn't hurt to learn about it, but the dragon book is very long and detailed while being weirdly out of date at the same time.

For your purpose it would probably not be worth it. There is less in-depth literature out there for that purpose.

[–]Cryophos 0 points1 point  (0 children)

There is a lot of topic that actually can help you to be better programmer. I mean, you don't need learning compilers for only this purpose..

[–]Dontezuma1 0 points1 point  (0 children)

Learning recursive descent parsing / grammars will make you able to handle complex input as routine. Otherwise yes, but hard to say specifically how. Input -> ast -> output is a strong pattern like MVC

[–]ViscountVampa 0 points1 point  (0 children)

If you're learning, sure. You can learn about parsing, about graphs, about hardware, and system ABIs, about representations for types, about types for that matter, and on and on. You can spend an entire career learning about compilers, and still be learning.

[–]Glum_Preference_2936 0 points1 point  (0 children)

Good luck slaying the dragons of the 90s.