Writing a C/C++ compiler in C++

dezakin@usa.net (Dez Akin)
22 Jan 2004 23:31:37 -0500

          From comp.compilers

Related articles
Writing a C/C++ compiler in C++ dezakin@usa.net (2004-01-22)
Re: Writing a C/C++ compiler in C++ david.boyle@ed.tadpole.com (2004-01-31)
Re: Writing a C/C++ compiler in C++ haberg@matematik.su.se (2004-02-01)
Re: Writing a C/C++ compiler in C++ jo@spiffy.ox.compsoc.net (Joel Dillon) (2004-02-01)
Re: Writing a C/C++ compiler in C++ vbdis@aol.com (2004-02-01)
Re: Writing a C/C++ compiler in C++ dezakin@usa.net (2004-02-01)
Re: Writing a C/C++ compiler in C++ vbdis@aol.com (2004-02-04)
[5 later articles]
| List of all articles for this month |

From: dezakin@usa.net (Dez Akin)
Newsgroups: comp.compilers
Date: 22 Jan 2004 23:31:37 -0500
Organization: http://groups.google.com
Keywords: practice, C++, question
Posted-Date: 22 Jan 2004 23:31:37 EST

I've been thinking of writing a C++ compiler in C++ over the next
several years, and I was wondering what's changed in writing a
compiler?


I've been pouring over these groups and there seems to be a lot of
tools for starting but is the modern process still the same? As far as
I understand it you write a lexer that tokenizes all the symbols, then
write a parser that parses all of the tokens, then walks the parse
tree to generate the asm or IL that gets shoved to the backend.


So it seemed straightforward except that C++ isn't a LALR(1) grammer
that Bison or Byacc accepts. Does this pose problems in writing the
lexer?


Basically I'd like to use a lot of generic programming components such
as STL and boost templates for doing much of the pattern matching and
tree manipulation, and I'm looking for a place to start. Can I start
with a simple lexer or lexer generator, or does that not make sense
for C++ (or even just C)?


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.