Re: Is Assembler Language essential in compiler construction?

torbenm@pc-003.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Wed, 11 Feb 2009 16:46:18 +0100

          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)
Re: Is Assembler Language essential in compiler construction? lkrupp@pssw.com (Louis Krupp) (2009-02-11)
Re: Is Assembler Language essential in compiler construction? cr88192@hotmail.com (cr88192) (2009-02-12)
Re: Is Assembler Language essential in compiler construction? marcov@stack.nl (Marco van de Voort) (2009-02-13)
[23 later articles]
| List of all articles for this month |
From: torbenm@pc-003.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Newsgroups: comp.compilers
Date: Wed, 11 Feb 2009 16:46:18 +0100
Organization: Department of Computer Science, University of Copenhagen
References: 09-02-021
Keywords: assembler, practice
Posted-Date: 11 Feb 2009 17:25:41 EST

marco.m.petersen@gmail.com writes:


> Is Assembler Language essential in compiler construction? I've read a
> few e-Books on compiler construction and it always says that knowledge
> of assembly is essential.
>
> I mean, if you wrote a program that converts code from BASIC to C++
> then calls another compiler to do the compilation process, wouldn't
> that be considered as a compiler?


It would indeed, but it is not necessarily easier than using an
assembly language -- it depends on how much your language looks like
C++ (or whatever your target HLL is).


Also, compiler textbooks often focus more on making the reader
understand what happens in a typical compiler than training him/her to
write a "real" compiler. Few CS graduates will ever write a
full-scale compiler, but they will all need to understand the cost of
what they write in a HLL, and to do that they need to understand how
the HLL code is eventually executed on a machine. So I don't see this
as a problem. In any case, this focus on understanding makes using
assembly or assembly-like target languages a good choice, where using
another HLL as target language would sweep a lot of details under the
carpet, even if this would be an easier approach.


If I were to write a full-scale compiler these days, I would probably
target a virtual machine instead of assembly language. This could be
JVM, .NET, llvm or something else, depending on my goals. But that
doesn't change the fact that you learn more by trying to write a
compiler that goes all the way to assembly -- even if this is only for
a toy language.


Torben



Post a followup to this message

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