Re: How to justify teaching compilers

torbenm@diku.dk (Torben Ęgidius Mogensen)
9 Oct 2004 22:32:21 -0400

          From comp.compilers

Related articles
[3 earlier articles]
Re: How to justify teaching compilers max@gustavus.edu (Max Hailperin) (2004-10-02)
Re: How to justify teaching compilers Juergen.Kahrs@vr-web.de (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2004-10-04)
Re: How to justify teaching compilers tk@ic.unicamp.br (Tomasz Kowaltowski) (2004-10-04)
Re: How to justify teaching compilers genew@mail.ocis.net (Gene Wirchenko) (2004-10-04)
Re: How to justify teaching compilers slimick@venango.upb.pitt.edu (John Slimick) (2004-10-04)
Re: How to justify teaching compilers nmm1@cus.cam.ac.uk (2004-10-09)
Re: How to justify teaching compilers torbenm@diku.dk (2004-10-09)
Re: How to justify teaching compilers monnier@iro.umontreal.ca (Stefan Monnier) (2004-10-09)
Re: How to justify teaching compilers rand@rice.edu (Randy) (2004-10-09)
Re: How to justify teaching compilers vbdis@aol.com (2004-10-09)
Re: How to justify teaching compilers house@usq.edu.au (Ron House) (2004-10-09)
Re: How to justify teaching compilers rbates@southwind.net (Rodney M. Bates) (2004-10-12)
| List of all articles for this month |

From: torbenm@diku.dk (Torben Ęgidius Mogensen)
Newsgroups: comp.compilers
Date: 9 Oct 2004 22:32:21 -0400
Organization: Department of Computer Science, University of Copenhagen
References: 04-10-009
Keywords: courses
Posted-Date: 09 Oct 2004 22:32:21 EDT

"Pg Nor Jaidi Pg Tuah" <jaidi@fos.ubd.edu.bn> writes:


> With the fast expanding frontier of computer science, and the
> (unreasonable) expectation that CS graduates be fully "productive"
> from day 1 of their work, CS curriculum must include more "hot"
> topics, squeezing out "old fashioned" stuff.
>
> Thus I find my "compiler is fun" argument losing to "compiler
> knowledge is not so useful anymore" argument, especially when more
> than half of the students would likely find the subject terribly
> difficult. If you are in this situation, and you have no strong
> compiler research group to back you up (if you have a compiler
> research group, you wouldn't be in this situation, would you?), how
> would you justify keeping/introducing your beloved compiler course?


In my notes on compilers, I have included the following motivations:


  1) A good craftsman should know his tools, and compilers are important
        tools for programmers and computer scientists.


  2) The techniques used for constructing a compiler are useful for
        other purposes as well.


  3) There is a good chance that a programmer or computer scientist will
        need to write a compiler or interpreter for a domain-specific
        language.


To elaborate a bit on these:


Ad. 1): Understanding how a compiler is built will allow programmers
to get an intuition about what their high-level programs will look
like when compiled and use this intuition to tune programs for better
efficiency. Furthermore, the error reports that compilers provide are
often easier to understand when one knows about and understands the
different phases of compilation, such as knowing the difference
between lexical errors, syntax errors, type errors and so on.


Ad. 2): The techniques used for reading (lexing and parsing) the text
of a program and converting this into a form that is easily
manipulated by a computer, can be used to read and manipulate any kind
of structured text such as XML documents, adress lists, etc.


Ad. 3): This is becoming more and more important as domain specific
languages (DSL's) are gaining in popularity. A DSL is a (typically
small) language designed for a narrow class of problems. Examples are
data-base query languages, text-formatting languages, scene
description languages for ray-tracers and languages for setting up
economic simulations. The target language for a compiler for a DSL
may be traditional machine code, but it can also be another high-level
language for which compilers already exist, a sequence of control
signals for a machine, or formatted text and graphics in some
printer-control language (e.g. PostScript). Even so, all DSL
compilers will share similar front-ends for reading and analysing the
program text.


> If you can compromise and reduce compiler to just a few hours of
> lectures (embedded in, say, "systems programming"), what would you
> cover?




This is a tough nut. With just a few hours, I can't really see that
you can do much more than describe the purpose of the different phases
of a compiler without going into details of the how. You could,
maybe, focus on the compilers-as-tools aspect and enable students to
understand the difference between lexical, syntax and type error
messages, and possibly also make them have a feel for what type of
code different language constructs generate.


Torben


Post a followup to this message

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