Re: Teaching compilers backwards?

=?ISO-8859-1?Q?Peter_Fr=F6hlich?= <phf@cs.ucr.edu>
19 Mar 2004 23:56:51 -0500

          From comp.compilers

Related articles
[10 earlier articles]
Re: Teaching compilers backwards? zork_666@nospammail.net (Johnathan) (2004-03-15)
Re: Teaching compilers backwards? romesamo@earthlink.net (Rome Samo) (2004-03-19)
Re: Teaching compilers backwards? aycock@cse.cpsc.ucalgary.ca (John Aycock) (2004-03-19)
Re: Teaching compilers backwards? lex@cc.gatech.edu (Lex Spoon) (2004-03-19)
Re: Teaching compilers backwards? k301x@yahoo.com (dtf) (2004-03-19)
Re: Teaching compilers backwards? vbdis@aol.com (2004-03-19)
Re: Teaching compilers backwards? phf@cs.ucr.edu (=?ISO-8859-1?Q?Peter_Fr=F6hlich?=) (2004-03-19)
Re: Teaching compilers backwards? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-03-26)
Re: Teaching compilers backwards? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-03-26)
Re: Teaching compilers backwards? nr@eecs.harvard.edu (2004-03-26)
Re: Teaching compilers backwards? torbenm@diku.dk (2004-03-26)
| List of all articles for this month |

From: =?ISO-8859-1?Q?Peter_Fr=F6hlich?= <phf@cs.ucr.edu>
Newsgroups: comp.compilers
Date: 19 Mar 2004 23:56:51 -0500
Organization: Compilers Central
References: 04-03-066
Keywords: courses
Posted-Date: 19 Mar 2004 23:56:51 EST

Hi all!


On Monday, Mar 15, 2004, at 06:37 US/Pacific, Johnathan wrote:


> I'm at the stage where I'm doing compiler construction and I agree.
> Compiler courses are very unsatisfactory because we don't write real
> compilers or really learn anything. By the time the exam is "last
> week," everything is pretty much forgotten. The course runs way too
> fast and everything is vague and abstract. If we're lucky we'll do a
> stupid YARPNC (Yet Another Reverse Polish Notation Calculator).


I have been teaching one of those "dreaded" (if I read the other
comments in this thread right) single quarter courses three times now,
one time in a 6 week summer session. Students write a compiler from
scratch and target an actual "machine" not just another source
language like C.


In my mind, the key to make this work is to focus on *simple* language
concepts. For example, students in my course do *not* implement
procedures. We talk about how it is done in lecture, and if they feel
like it they can do it (yes, there's always one or two students who
are excited enough and who just can't stop hacking); but it is not
required. What is required is constants, variables,
integer/array/record types, assignments, if, while/repeat, and basic
input/output instructions; and expressions of course.


The programming assignments are structured into scanner, parser,
symbol table, abstract syntax tree, interpreter, and finally code
generator. Until this quarter I used a simple stack machine of my own
design, but I asked people to volunteer for MIPS, and some did. Next
quarter it's going to be MIPS only. The goal is not to generate "good"
code at all, all they need to do is "simulate" a stack machine on the
MIPS. Optionally they can do more, and one of the "excited" students
actually wrote a graph-coloring register allocator this quarter.


> I have issues with the textbooks too. They are boring and extremely
> hard to decipher.


I agree. The only text I ever *really* liked is Wirth's and that's out
of print. Sad but true. The Cooper/Torzcon text is decent, but it
doesn't match my course very well. So I keep using my old slides, and
that seems to work decently. I recommend Cooper or Appel as
"background reading" for interested students though.


> [Maybe it's a cultural thing. Americans think Gone with the Wind is
> a good read, and I never had trouble with a one-semester compiler
> course. We had a lot of latitude, so I wrote an APL subset to Basic
> translator in Trac. It worked. -John]


I think so, too. However, it seems that my "American" students like my
"European" approach quite well. Not all of course, there's a number of
students each quarter who drop because it seems too much work for
them. Those who stay, however, usually have a distinct "glow" about
them after the quarter, feeling that there's not a lot of courses left
in the program to challenge them further. :-)


However, I *do* agree that a two-part course would be much better. At
UC Irvine, there's one required course similar to mine and one
optional course where procedures and other "advanced" concepts are
addressed. At UC Riverside, where I teach right now, there's only one
course (except for a further project course, which is not coordinated
too well with the regular compiler course however).


I guess all I wanted to say is that things *can* work out in a single
quarter, but that there's always room for improvement. :-)


Peter
--
Peter H. Froehlich <><><><><><> http://www.cs.ucr.edu/~phf/
OpenPGP: D465 CBDD D9D2 0D77 C5AF 353E C86C 2AD9 A6E2 309E


Post a followup to this message

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