1

I'm not sure if this is an acceptable question, but compiler-os-design-where-to-start was, so I figured that I'd take a shot at it.

I have taken no formal Computer Science classes. I have programmed in Python and attempted C# without success. My technical vocabulary is expansive, yet scattered over a very wide range of computer science topics.

I have a very long way to go before I can get to a level where I could reasonably read a book about compiler design/theory. I am asking what steps I need to take before attempting compiler design. I have some examples here already:

  • Computer architecture
  • Binary
  • How booting/kernels/OSes work
  • Imperative vs. Comparative language design
  • "Grammars"

At least these are some examples of what I've seen.

Edit: I can't for the life of me see how this problem is unclear. I quite clearly bolded what I was asking. I was expecting it to be marked as biased, vague/broad, or too generalized, but certainly not unclear. Don't be afraid to say it's unconstructive (just make sure whatever it is classified under is accurate).

13
  • 8
    How about "Pick up the dragon book, when unsure of term, google". Lack of vocabulary isn't really a reason not to even try to read something. Commented Sep 18, 2013 at 5:05
  • Generally speaking, the better programming books on these types of subjects attempt to avoid using unfamiliar terms or clarify new terms, as understanding the contents of the book is the objective. If they are using terms which aren't clarified, chances are they are terms you should probably already know them, which is all the more reason to google them yourself.
    – Neil
    Commented Sep 18, 2013 at 6:13
  • @Stopforgettingmyaccounts... specifically, what problem do you have understanding? Lexing? Parsing? Symbol tables and name spaces? Optimizations? Code generation? Symbol trees? How far did you get into it before getting confused?
    – user40980
    Commented Sep 18, 2013 at 22:07
  • @jozefg I tried it, but didn't want to continue because I feel like I'm missing a lot of things (page 3). I'm using version 1 of the book, since I cannot access version 2 as an ebook right now (and I suspect it's mostly inconsequential). And it's somewhat counter-intuitive to learn compiler design and theory before I learn the framework that makes them up. I think learning for computers should be circuits -> Memory allocation -> CPU/Booting/OS -> Software, but I think that I am missing some prerequisites along the way. That's why I'm asking for them.
    – kettlecrab
    Commented Sep 18, 2013 at 23:31
  • 2
    Stumbled across a question you might like to read How do I create my own programming language and a compiler for it - the top answer is by Eric Lippert who knows a few things about compilers.
    – user40980
    Commented Sep 22, 2013 at 2:43

2 Answers 2

10

Compilers are not some mythical creatures, even though some people might like you to think that.

A compiler is a program like any other program. It takes some input, tries to make sense of it, and generates some output. Have you ever written a program which reads a text file in some format and outputs some HTML based on that text? Well, congratulations: you already have written a compiler. A very simple one, I admit, but it is a compiler.

You approach it like any other program: try, fail, learn, repeat.

Some resources to help you fail less and learn more :-)

1
  • Id add compiling with continuations and modern compiler design Commented Sep 18, 2013 at 23:20
2

Nicklaus Wirth's text on compiler construction is arguably one of the two most approachable texts on the subject. The other is Jack Crenshaw's series of articles, cited by the other guy.

If you want to go the Dragon Book route, there's no easy approach, but you can start by working your way through Course 6 at ocw.mit.edu. You'll have to pick and choose the Computer Science classes.

Not the answer you're looking for? Browse other questions tagged or ask your own question.