Compiler Creation

Started by
10 comments, last by ChaosEngine 16 years, 3 months ago
I would like to build a compiler in C++. I have sort of created a parser, but don't know what to do. Please help me and point me to places where this has been done. I think I know what I am getting myself into, so I am okay with taking a long time.
Advertisement
Principles of Compiler Design is avaliable pretty cheap on Amazon.

You can get a free PDF copy of Basics of Compiler Design

You can find other resources here

You can use tools like Bison, Lex, and Yacc to do some of the work for you. Given a grammar defintion, usually in Backus Naur Form, they'll output code for a parser and lexical analyzer for that grammar.
Patrick
The famous, "Lets build a compiler" series by Jack Crenshaw.

http://compilers.iecc.com/crenshaw/

Its a quick and practical guide to building a compiler. Not overly done with theory. Which helped me ease into things I think.
-----------------------------www.devcrunch.com - independant developer forums
Is C++ an okay language for compiler design or is there a better alternative?
I would think that if you have to ask that question, you aren't ready to make a compiler. A compiler is probably one of the most difficult software projects to undertake, next to an MMOG and an operating system.
Mike Popoloski | Journal | SlimDX
Dude: don't do it. Instead, embed a python or Lua interpreter. Creating a compiler is what you do if you want to create a new programming language.

Quote:Original post by Mike.Popoloski
I would think that if you have to ask that question, you aren't ready to make a compiler. A compiler is probably one of the most difficult software projects to undertake, next to an MMOG and an operating system.

Yeah I have a book on how to make your own compiler in vb.net and that was complicated enough.

[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
Quote:Original post by billmason
Is C++ an okay language for compiler design or is there a better alternative?


It's 'okay'. I tend to favor O'Caml as a compiler development language, mostly because this is what it was created for in the first place (and it's pretty darn good at it, too).
Is it possible to use Python scripts in a C++ program?? That sounds like an excellent alternative.
Too right it is!

This topic is closed to new replies.

Advertisement