From: | Hans Aberg <haberg_20080406@math.su.se> |
Newsgroups: | comp.compilers |
Date: | Wed, 11 Feb 2009 15:57:39 +0100 |
Organization: | Aioe.org NNTP Server |
References: | 09-02-021 |
Keywords: | practice, assembler |
Posted-Date: | 11 Feb 2009 10:04:44 EST |
marco.m.petersen@gmail.com wrote:
> 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?
Yes, formally a compiler just translates one computer language into
another. For example, an assembler translates into the machine code
language.
One uses T-diagrams to describe this:
http://scifac.ru.ac.za/compilers/cha03g.htm
http://en.wikipedia.org/wiki/Compiler
> 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.
This leads to the question of boot-strapping and self-compilation,
described further down on the first link above. One can write an
assembler by writing some parts in machine code and let it self-compile,
a C-compiler by writing some parts in assembler and let it self-compile,
or a C++ or Haskell compiler (like GHC at least in the past) by letting
it generating C. Then some parts may still be written in assembler for
optimization reasons. A compiler may use an in-house intermediate
optimized for its portability and spectrum of supported languages (like
GCC, I think).
Hans Aberg
Return to the
comp.compilers page.
Search the
comp.compilers archives again.