Re: Is Assembler Language essential in compiler construction?

Tim <tim.d.richards@gmail.com>
Wed, 11 Feb 2009 04:12:10 -0800 (PST)

          From comp.compilers

Related articles
Is Assembler Language essential in compiler construction? marco.m.petersen@gmail.com (2009-02-09)
Re: Is Assembler Language essential in compiler construction? mburrel@uwo.ca (Mike Burrell) (2009-02-10)
Re: Is Assembler Language essential in compiler construction? rpboland@gmail.com (Ralph Boland) (2009-02-10)
Re: Is Assembler Language essential in compiler construction? bartc@freeuk.com (Bartc) (2009-02-11)
Re: Is Assembler Language essential in compiler construction? tim.d.richards@gmail.com (Tim) (2009-02-11)
Re: Is Assembler Language essential in compiler construction? walter@bytecraft.com (Walter Banks) (2009-02-11)
Re: Is Assembler Language essential in compiler construction? haberg_20080406@math.su.se (Hans Aberg) (2009-02-11)
Re: Is Assembler Language essential in compiler construction? torbenm@pc-003.diku.dk (2009-02-11)
Re: Is Assembler Language essential in compiler construction? anton@mips.complang.tuwien.ac.at (2009-02-11)
Re: Is Assembler Language essential in compiler construction? anton@mips.complang.tuwien.ac.at (2009-02-11)
Re: Is Assembler Language essential in compiler construction? cfc@shell01.TheWorld.com (Chris F Clark) (2009-02-11)
[14 later articles]
| List of all articles for this month |

From: Tim <tim.d.richards@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 11 Feb 2009 04:12:10 -0800 (PST)
Organization: Compilers Central
References: 09-02-021 09-02-029
Keywords: assembler, practice
Posted-Date: 11 Feb 2009 10:03:33 EST

> Frankly, most university first courses on compilers don't spend much
> time on the back end of compilers; there just isn't time. And the
> assembly languages of most modern processors are just too complex. I
> would like to see the Java virtual machine or some other used virtual
> machine be the target language for a first course on compilers, if
> that is not already too much information. Students would find this
> more interesting and useful than a faked machine language and more
> reasonable than a real assembly language.


I taught an undergraduate course on compiler construction where we
used JVM bytecode as the target instruction set. We then used the
Jasmin bytecode assembler to generate class files. Overall, I feel
that it was a great success. Because the JVM is at a higher level
(and concepts are similar to the Java language) and is stack oriented,
students were able to pick it up quickly. You can also apply register
allocation techniques to determine the minimal number of stack slots
required for local variables. Because most students do not go on to
do compiler work, the focus on the JVM allows them to get a better
understanding of the platform (JVM) they are working on---so it is a
win/win situation.


> A slightly different option would be to compile to some intermediate
> language used in a real compiler such that the students could use the
> real compiler to finish the translation into machine code. This would
> require a cooperative compiler with a reasonably simple intermediate
> language.


This is also a great option. It is great if the compiler framework
allows optimizations to be coded up easily---this allows students to
get their hands dirty with high-level IR-oriented optimizations. LLVM
comes to mind.


> The back end is where the real compiler work is done though, so a
> second course, possibly at the graduate level, that dealt with
> compiler back ends would be useful. Such a course could deal with
> translating virtual machine code into real machine code. I recommend
> compiling to a processor whose machine language is not too complex,
> and is really used today, say for embedded applications.
>
> I think a compiler book using these ideas would be very successful
> especially if universities used it in their compiler courses. Wish I
> had sufficient knowledge to write it but I only know front ends well.


The ideal scenario is probably one where the computer architecture,
programming language, and compiler construction courses worked
together to teach students a specific architecture assembly language,
how to deal with programming language theory (including lexing and
parsing), and programming language construction (focusing more on the
middle/back- end phases).


/Tim


Post a followup to this message

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