Re: Java compiler courses

wooks <>
25 Apr 2007 04:15:46 -0400

          From comp.compilers

Related articles
Java compiler courses (wooks) (2007-04-20)
Re: Java compiler courses (Russell Shaw) (2007-04-23)
Re: Java compiler courses (Andy Johnson) (2007-04-23)
Re: Java compiler courses (glen herrmannsfeldt) (2007-04-23)
Re: Java compiler courses (Hans-Peter Diettrich) (2007-04-23)
Re: Java compiler courses (Chris Dollin) (2007-04-23)
Re: Java compiler courses (Karsten Nyblad) (2007-04-25)
Re: Java compiler courses (wooks) (2007-04-25)
Re: Java compiler courses (Hans-Peter Diettrich) (2007-04-25)
Re: Java compiler courses (2007-04-26)
Re: Java compiler courses (Michael Klemm) (2007-04-26)
Re: Java compiler courses (George Neuner) (2007-04-26)
Re: Java compiler courses (glen herrmannsfeldt) (2007-04-26)
Re: Java compiler courses (Chris F Clark) (2007-04-26)
[10 later articles]
| List of all articles for this month |

From: wooks <>
Newsgroups: comp.compilers
Date: 25 Apr 2007 04:15:46 -0400
Organization: Compilers Central
References: 07-04-07407-04-082
Keywords: Java, courses
Posted-Date: 25 Apr 2007 04:15:46 EDT

On Apr 23, 12:49 pm, glen herrmannsfeldt <>
> wooks wrote:
> > Why do they exist.
> > Why would anybody want to teach a compiler course in Java when it
> > seems that there are more and better resources (books, tools)
> > supporting a compilers course based on C (aside from the obvious -
> > students are taught Java and not C).
> Well, first, Java compilers are likely to be written in Java,
> following the tradition of writing compilers in the language
> that they compile.

But that presupposes the course is aiming to build a compiler for Java
- which may be the case - and then may not. If you are on a 10 week
course being asked to design a compiler for an OO subset is like
being asked to run before you've learnt to walk.

> > Why would anybody want to write a compiler in Java (unless it's the
> > only language they know).
> Java has much better support for string handling than C does. It is
> likely slower, but that isn't always a limitation for a compiler.
> Computers are now fast enough, and with JIT java is usually
> pretty fast. Debugging mistakes in string handling in C,
> such as overrunning the end of a string, is not easy. Java
> checks string bounds, simplifying debugging.

Those are all the sort of arguments one could make for writing
compilers in ..... (insert your favourite higher level (than C)

> Now, why would anyone want to write a compiler in C?

For the reasons I stated in my post.

1. Better documented C based tools (lex/flex, yacc/bison). Hence why
instructors on Java courses keep referring students to the GNU
documentation in preference to CUP.

2. More books to choose from so that you can find the right one for
you (and there's a better chance that you can find it in the library)
which is important. There are only 3 Java books - Appel, Watt and the
one by Patrick Terry (not available via and a hefty 46GBP
2nd hand in the UK).

3. Don't need to get to grips with the non intuitive Visitor Pattern -
if you're on a course thats taught over 10 weeks there's enough new
concepts to worry about in that short period of time.

PS - C is not my language of choice for programming in general - it
just seems that it is best suited for this application.

Post a followup to this message

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