Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This question already has an answer here:

I want to write my own compiler for my own language. Yes, it's going to be hard, and it will take long, but I think it will be worth it.

I have looked into OSDev.org, and read about executable formats there, but they aren't much help. I am looking for information beyond what they have there.

So, anything will help. Books, websites, PDFs, anything.

I am looking into 32-bit, not 64- or 16-bit.

share|improve this question

marked as duplicate by World Engineer Feb 28 at 21:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
meta.stackexchange.com/questions/25840/…. He gives a list of stackoverflow posts that will answer this question. He's not downvoted because of the list (the list of posts are useful). –  jmq Mar 2 '12 at 23:27
    
Hello Marcus Szanto and welcome to Programmers! This is an extremely broad question, and can not be reasonably answered. Please do some research of your own, and when you start building your compiler feel free to ask specific questions. –  Yannis Rizos Mar 2 '12 at 23:54
add comment

1 Answer

I would think the best place to start in practical terms would be a solid foundation in using lex and yacc (or flex and bison), since these are likely the tools you'll use to actually build the compiler. There's a tutorial here, and O'Reilly has a great book about them.

From a theoretical standpoint, you'll want to study compiler design. Google turns up plenty of quality resources, but the the classic book on the subject is Compilers: principles, techniques, and tools by Alfred V. Aho. I can't recommend it highly enough.

share|improve this answer
    
    
Personally, I think you learn more from a hand-crafted lexer and recursive descent parser. Symbols, types and fragments are where the fun is. I dislike Aho, but it is unavoidable. Lambda is a better home than here for inhaling the essence. –  david.pfx Mar 26 at 13:50
add comment

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