Re: Java compiler courses

torbenm@app-7.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
26 Apr 2007 09:37:11 -0400

          From comp.compilers

Related articles
[3 earlier articles]
Re: Java compiler courses gah@ugcs.caltech.edu (glen herrmannsfeldt) (2007-04-23)
Re: Java compiler courses DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-23)
Re: Java compiler courses chris.dollin@hp.com (Chris Dollin) (2007-04-23)
Re: Java compiler courses 148f3wg02@sneakemail.com (Karsten Nyblad) (2007-04-25)
Re: Java compiler courses wookiz@hotmail.com (wooks) (2007-04-25)
Re: Java compiler courses DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-25)
Re: Java compiler courses torbenm@app-7.diku.dk (2007-04-26)
Re: Java compiler courses usenet@gmx.info (Michael Klemm) (2007-04-26)
Re: Java compiler courses gneuner2@comcast.net (George Neuner) (2007-04-26)
Re: Java compiler courses gah@ugcs.caltech.edu (glen herrmannsfeldt) (2007-04-26)
Re: Java compiler courses cfc@shell01.TheWorld.com (Chris F Clark) (2007-04-26)
Language features for compiler writing was: Java compiler courses cfc@shell01.TheWorld.com (Chris F Clark) (2007-04-27)
Re: Java compiler courses DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-27)
[18 later articles]
| List of all articles for this month |

From: torbenm@app-7.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Newsgroups: comp.compilers
Date: 26 Apr 2007 09:37:11 -0400
Organization: Department of Computer Science, University of Copenhagen
References: 07-04-074 07-04-084
Keywords: courses, Java
Posted-Date: 26 Apr 2007 09:37:11 EDT

Hans-Peter Diettrich <DrDiettrich1@aol.com> writes:


> wooks wrote:
>
>> Why would anybody want to write a compiler in Java (unless it's the
>> only language they know).
>
> What should the students learn: writing compilers in C, or writing
> compilers in general?


C is a horrible language for writing compilers due to bad
infrastructure for tree and list structures (i.e., GC, polymorphism
and pattern matching). C++ has polymorphism (through templates), but
still lacks GC and pattern matching. Java has GC, newer versions also
have polymorphism, but it still lacks pattern matching. ML (several
variants including SML, OCaml and F#), Haskell and even Prolog are
better choices as all these have GC, polymorphism and pattern
matching.


> While speed may be an argument in an commercial compiler, a compiler
> course should spot the principles of an compiler, not the details.


I fully agree. So choose an infrastructure (language etc.) that
supports these principles without requiring you to take care of a lot
of details (such as GC, bounded datastructures, low-level building and
inspection of data structures, etc.).


> A modular OO approach, as required by Java, IMO is a good starting
> point for every big project.


Modular, yes. OO, maybe. I have yet to see any major benefits OO
gives you in compiler writing that you can't get through polymorphism
and ML-style modules. And ML-style datatstructres are (IMO) much
easier than objects for representing syntax trees etc.


Torben
[I entirely agree. Data structures and pattern matching are really useful,
OOP isn't for writing compilers. So I write stuff in perl. -John]



Post a followup to this message

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