424
votes

I am thorough with programming and have come across languages including BASIC, FORTRAN, COBOL, LISP, LOGO, Java, C++, C, MATLAB, Mathematica, Python, Ruby, Perl, JavaScript, Assembly and so on. I can't understand how people create programming languages and devise compilers for it. I also couldn't understand how people create OS like Windows, Mac, UNIX, DOS and so on. The other thing that is mysterious to me is how people create libraries like OpenGL, OpenCL, OpenCV, Cocoa, MFC and so on. The last thing I am unable to figure out is how scientists devise an assembly language and an assembler for a microprocessor. I would really like to learn all of these stuff and I am 15 years old. I always wanted to be a computer scientist someone like Babbage, Turing, Shannon, or Dennis Ritchie.


I have already read Aho's Compiler Design and Tanenbaum's OS concepts book and they all only discuss concepts and code in a high level. They don't go into the details and nuances and how to devise a compiler or operating system. I want a concrete understanding so that I can create one myself and not just an understanding of what a thread, semaphore, process, or parsing is. I asked my brother about all this. He is a SB student in EECS at MIT and hasn't got a clue of how to actually create all these stuff in the real world. All he knows is just an understanding of Compiler Design and OS concepts like the ones that you guys have mentioned (i.e. like Thread, Synchronization, Concurrency, memory management, Lexical Analysis, Intermediate code generation and so on)

7
  • If you are on Unix/Linux, you can get information about dedicated tools: lex, yacc and bison.
    – mouviciel
    Commented Oct 24, 2011 at 10:03
  • My first suggestion would be to Read the Dragon Book by Aho. amazon.com/Compilers-Principles-Techniques-Alfred-Aho/dp/…
    – Julian
    Commented Oct 24, 2011 at 10:04
  • 1
    Maybe not too helpful, but I recommend going through sites.google.com/site/steveyegge2/blog-rants (Steve Yegge's blog), and steve-yegge.blogspot.com/ (Steve Yegge's other blog).
    – KK.
    Commented Oct 24, 2011 at 13:20
  • 3
    Learn as many programming languages as you can. That way you will learn from their concepts as well as their mistakes. Why be content with dwarfs, when you can stand on the shoulder of giants?
    – sbi
    Commented Oct 24, 2011 at 13:54
  • 1
    hint: an interpreter is easier than a compiler; it's just a class that "does something" based on input text that it reads line by line. another hint: tie this to reflection and you can control arbitrary objects with your script. Commented Aug 14, 2016 at 22:18

33 Answers 33

1
2
-2
votes

Coursera is offering a free 10-week course on compilers soon. You can also have a look at the lecture videos here. The lecture videos include the following topics:

  • The Cool Programming Language
  • Lexical analysis
  • Finite Automata
  • Parsing
  • Top-Down Parsing
  • Bottom-Up Parsing
  • Semantic Analysis and Type Checking
  • Cool Type Checking
  • Runtime Organization
  • Code Generation
  • Opertational Semantics
  • Local Optimization
  • Global Optimization
  • Register Allocation
  • Garbage Collection
  • Java

You may also be interested in some podcasts about compiler construction.

-3
votes

Making your own (simple) compiler isn't much difficult. Try http://briancbecker.com/bcbcms/site/proj/comptut.html. It is an incomplete tutorial but it gives you a great start to build a compiler in C++. You may also find Let's Build a Compiler useful but I don't know Pascal so I couldn't understand it much.

One good thing about BCB Compiler Tutorial is that it doesn't teach much theory and doesn't use all those confusing terms like Lexer, Parsing, etc. Very good for beginners.

-4
votes

Please don't listen to these people. Assembler isn't worth anything on its own, nor is any other language, nor is any other knowledge for that matter. The only thing that counts, is that you have fun completing projects. You can go from there, it is completely unnecessary to learn all the low level stuff before you have the faintest idea that you even need to go that deep.

Go through this tutorial and build your own language: http://llvm.org/docs/tutorial/

Learn everything about the llvm and clang compiler toolchain. You are going to be just fine, and you'll actually achieve something instead of reading thousands of pages of meaningless theory.

Don't let these people discourage you. It is absolutely not necessary to go to college. Most "experts" and professors know near nothing, trust me. Go to college because it's a life lesson, not to learn something. You can learn on your own.

1
  • 6
    And the final piece of advice - never take advice from someone who thinks that experts and professors don't know anything. He was the guy sitting at the back playing games on his laptop during lectures ... if he bothered to attend :-)
    – Stephen C
    Commented Aug 23, 2012 at 23:34
1
2

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