Re: how to write a compiler

Michael Meissner <mrmnews@the-meissners.org>
15 Jul 2003 14:58:21 -0400

          From comp.compilers

Related articles
how to write a compiler sam__c@rediffmail.com (2003-07-02)
Re: how to write a compiler rjaishan@quicklogic.com (Jaishankar R) (2003-07-04)
Re: how to write a compiler bonzini@gnu.org (2003-07-04)
Re: how to write a compiler martinez_miguel@yahoo.com (2003-07-13)
Re: how to write a compiler mrmnews@the-meissners.org (Michael Meissner) (2003-07-15)
Re: how to write a compiler bonzini@gnu.org (2003-07-17)
Re: how to write a compiler alex@alexmcguire.com (Alex McGuire) (2003-07-25)
Re: how to write a compiler nicolas_capens@hotmail.com (2003-07-31)
Re: how to write a compiler suresh@sankhya.com (2003-07-31)
Re: how to write a compiler ertr1013@student.uu.se (Erik Trulsson) (2003-08-04)
Re: how to write a compiler boldyrev+nospam@cgitftp.uiggm.nsc.ru (Ivan Boldyrev) (2003-08-10)
[3 later articles]
| List of all articles for this month |

From: Michael Meissner <mrmnews@the-meissners.org>
Newsgroups: comp.compilers
Date: 15 Jul 2003 14:58:21 -0400
Organization: http://extra.newsguy.com
References: 03-07-009 03-07-055
Keywords: practice
Posted-Date: 15 Jul 2003 14:58:21 EDT

bonzini@gnu.org (Paolo Bonzini) writes:


> > i'm taking up a 6 month term project in my bachelor's degree
> > course.can someone tell me the roadmap for writing a complier.and also
> > suggest the language(maybe c,java etc..or develop a custom
> > lang??)....plus is it a good idea to try for translators(c to
> > java,MSIL to java bytecode etc...)in the same semester??
> > samy
>
> C is not that hard, but refrain from using Bison/YACC to generate the
> grammar: it might look harder but it pays off most of the times.
> Bison is ok only for home-made little languages, but otherwise you
> often end up with a messy grammar.


Well typedef names will always be the bane of lexers/parsers, since you need to
have scope dependent feedback between the grammar and determining whether
something is a typedef or a normal identifier.


> It can be interesting to develop a small C compiler like tcc to plug
> in some optimizations. Following Appel's "Modern Compiler
> Implementation in *you-named-it*" books can provide a good place
> roadmap.
>
> If you want to do a good compiler with register allocation and the
> like, 6 months can be a start. Then if you have time you can go on
> with the more complex chapters, which deal with improved data-flow
> analysis algorithms, CSE, SSA, or loop optimization for example.


Having a regular machine, with plenty of registers to generate code for would
be a help on such a short term project. The x86 architecture is not what I
would call regular, nor particularly blessed with many registers :-)


--
Michael Meissner
email: mrmnews@the-meissners.org
http://www.the-meissners.org


Post a followup to this message

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