Re: Best tools for writing an assembler?

Robert A Duff <bobduff@TheWorld.com>
Wed, 19 Feb 2014 18:20:33 -0500 (EST)

          From comp.compilers

Related articles
Best tools for writing an assembler? tpphysik@gmail.com (2014-02-18)
Re: Best tools for writing an assembler? cbergstrom@pathscale.com (=?ISO-8859-1?Q?=22C=2E_Bergstr=F6m=22?=) (2014-02-19)
Re: Best tools for writing an assembler? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-02-19)
Re: Best tools for writing an assembler? ivan@ootbcomp.com (Ivan Godard) (2014-02-18)
Re: Best tools for writing an assembler? sebastien.fricker@gmail.com (=?ISO-8859-1?Q?S=E9bastien_Fricker?=) (2014-02-19)
Re: Best tools for writing an assembler? bobduff@TheWorld.com (Robert A Duff) (2014-02-19)
Re: Best tools for writing an assembler? bobduff@shell01.TheWorld.com (Robert A Duff) (2014-02-19)
Re: Best tools for writing an assembler? tpphysik@gmail.com (=?ISO-8859-1?Q?Patrik_T=FAri?=) (2014-02-20)
Re: Best tools for writing an assembler? sebastien.fricker@gmail.com (=?ISO-8859-1?Q?S=E9bastien_Fricker?=) (2014-02-21)
Re: Best tools for writing an assembler? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2014-02-21)
Re: Best tools for writing an assembler? bc@freeuk.com (BartC) (2014-02-22)
Re: Best tools for writing an assembler? noitalmost@cox.net (noitalmost) (2014-02-23)
[16 later articles]
| List of all articles for this month |

From: Robert A Duff <bobduff@TheWorld.com>
Newsgroups: comp.compilers
Date: Wed, 19 Feb 2014 18:20:33 -0500 (EST)
Organization: The World Public Access UNIX, Brookline, MA
References: 14-02-018 14-02-021
Keywords: assembler
Posted-Date: 21 Feb 2014 02:14:21 EST

Ivan Godard <ivan@ootbcomp.com> writes:


>...we use the C++ compiler as the first pass, then execute the resulting
> program as the second pass. You write a C++ function for each machine
> operation: "add(regNum r1, regNum r2)" or whatever.


Good idea, except I'd write it in Ada or OCaml or something. I've
done something similar.


You can do all sorts of powerful things this way, because you have the
full power of C++ (or whatever) at your fingertips.


And if you want to write a compiler for some higher-level language, it
can call those same "add" routines. I've never liked the compiler
design that has the compiler generate assembly language as text, and
then feed that text to a traditional assembler (even though I've
written such compilers). It seems needlessly inefficient. The only
sensible argument in favor of that is that it's the only way to ensure
that the assembler and the compiler agree on all the bit-wise
encodings of op-codes and so forth. In other words, it's the only way
to sufficiently test the assembler (since nobody writes large amounts
of assembly by hand anymore).


But your idea here solves that problem nicely -- there IS no assembler
in the tradition sense. Just the "add" and so forth routines.


- Bob



Post a followup to this message

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