Tell me more ×
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.

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)

share|improve this question
5  
Commenters: comments are meant for seeking clarification, not for extended discussion. If you have a solution, leave an answer. If your solution is already posted, please upvote it. If you'd like to discuss this question with others, please use chat. See the FAQ for more information. – user8 Jun 18 '11 at 22:42
2  
Today, a free on-line course starts at udacity, which seems to cover the very topic you are interested in. During the course, you will build a web browser that understands HTML and JavaScript. – Heinzi Apr 16 '12 at 9:12
show 2 more comments

migrated from stackoverflow.com Jun 15 '11 at 19:48

34 Answers

1 2

If you really have interests in compiler, and never did one before, you could start by designing a calculator for computing arithmetic formulas (a kind of DSL as Eric mentioned). There are many aspects you would need to consider for this kind of compiler:

  • Allowed numbers
  • Allowed operators
  • The operator priorities
  • Syntax validation
  • Variable look up mechanism
  • Cycle detection
  • Optimization

For example, you have the following formulas, your calculator should be able to calculate the value of x:

a = 1
b = 2
c = a + b
d = (3 + b) * c
x = a - d / b

It's not an extreme difficult compiler to start with, but could make you think more of some basic ideas of what a compiler is, and also help you improving your programming skills, and control the quality of your code (this actually is a perfect problem that Test Driven Development TDD could apply to improve the software quality).

share|improve this answer

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.

share|improve this answer

I was blessed to be exposed to the PDP-8 as my first assembly language. The PDP-8 had only six instructions, which were so simple it was easy to imagine them being implemented by a few discreet components, which in fact they were. It really removed the "magic" from computers.

Another gateway to the same revelation is the "mix" assembly language Knuth uses in his examples. "Mix" seems archaic today, but it still has that DE-mystifying effect.

share|improve this answer

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.

share|improve this answer
show 1 more comment
1 2

protected by Community Jul 28 '12 at 22:24

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

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