aspose file tools*
The moose likes General Computing and the fly likes Designing Compilers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Designing Compilers" Watch "Designing Compilers" New topic
Author

Designing Compilers

Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 104
I have to read a subject on compiler design in my b-tech course.Although I find the subject interesting(i.e the theoritical aspects of it) i would like to know how to design a compiler for a very basic programming language?Where should I start?
P.S. Please don't crack jokes(I have a pretty bad experience about it when I asked a question about genetic algorithm here!).


AyanBiswas
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

If you don't want jokes, then don't post in Meaningless Drivel.

There are tons of books on compilers. Pick one.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 495
    
    5
Ayan Biswas wrote:I have to read a subject on compiler design in my b-tech course.Although I find the subject interesting(i.e the theoritical aspects of it) i would like to know how to design a compiler for a very basic programming language?Where should I start?
P.S. Please don't crack jokes(I have a pretty bad experience about it when I asked a question about genetic algorithm here!).

I had a similar interest (but not the required education) couple of years ago.
This non-technical tutorial helped me understand fundamental concepts like tokenization, lexical analysis, expression evaluation, symbol tables, BNF, railroad diagrams, etc:
"Let's Build a Compiler, by Jack Crenshaw"

Once those basics are understood and you have a working compiler, perhaps you can move to understanding and implementing more sophisticated concepts like FSA (finite state automata) which most textbooks explain.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41489
    
  53
Compilers: Principles, Techniques, and Tools by Aho, Sethi, Lam, Ullman is the gold standard.


Ping & DNS - my free Android networking tools app
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

Ulf Dittmer wrote:Compilers: Principles, Techniques, and Tools by Aho, Sethi, Lam, Ullman is the gold standard.

Aka the dragon book. Used in senior level courses and grad schools all over the world for decades.
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
First, I'd a buy book on compilers. I recommend Modern Compiler Implementation in Java or Compilers: Principles, Techniques, and Tools. Then, I'd check out JLex, JavaCC and CUP, because it's probably not the best idea to try and create a compiler from scratch. There's a lot of formal language theory, automaton theory, and assembly language used in building compilers from the ground up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Designing Compilers