Re: Language used to write compilers

Rafael 'Dido' Sevilla <dido@imperium.ph>
30 Dec 2004 00:56:22 -0500

          From comp.compilers

Related articles
Language used to write compilers joe_hesse@actcx.com (Joe H.) (2004-12-29)
Re: Language used to write compilers dido@imperium.ph (Rafael 'Dido' Sevilla) (2004-12-30)
Re: Language used to write compilers nmm1@cus.cam.ac.uk (2004-12-30)
Re: Language used to write compilers s.bosscher@student.tudelft.nl (stevenb) (2004-12-30)
Re: Language used to write compilers vbdis@aol.com (2004-12-30)
Re: Language used to write compilers dido@imperium.ph (Rafael 'Dido' Sevilla) (2004-12-30)
Re: Language used to write compilers nick.roberts@acm.org (Nick Roberts) (2004-12-30)
Re: Language used to write compilers samiam@moorecad.com (Scott Moore) (2004-12-31)
[9 later articles]
| List of all articles for this month |

From: Rafael 'Dido' Sevilla <dido@imperium.ph>
Newsgroups: comp.compilers
Date: 30 Dec 2004 00:56:22 -0500
Organization: Compilers Central
References: 04-12-148
Keywords: courses
Posted-Date: 30 Dec 2004 00:56:21 EST

On Wed, Dec 29, 2004 at 01:45:09AM -0500, Joe H. wrote:
> I am thinking of taking a university course in compiler design. The
> instructor has chosen a book that teaches compiler implementation in
> Java. I always thought that compilers were usually written in C/C++.
>


I imagine the course focuses on the techniques used for writing
compilers, which should be applicable no matter what language you use.
While historically compilers were indeed written in C/C++, that was
probably because there were few usable alternatives in the past. I
have had experience writing compilers in C, and I can say that it is a
messy job that obscures the details of compiler design. C in
particular has very poor string handling capabilities, and most
compilers will need to often perform complex string manipulation in
the course of their operation. It is necessary to also create your
own ad hoc symbol tables and other data structures crucial to compiler
design, because the language doesn't have anything standard that will
suffice.


Java is a better language for this task, because of the automatic
garbage collection, reasonable string handling, and the decent library
of data structures that can be readily adapted to compiler
applications. There is also the ANTLR parser generator which does for
Java what Lex and Yacc do for C.


Nonetheless, the best language IMHO for writing compilers has got to
be Objective Caml.


> Question - what languages are used to write compilers? My world is
> Unix/Linux - should I wait until a course is offered using C/C++?


No.


Post a followup to this message

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