Related articles |
---|
[4 earlier articles] |
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) |
Re: Best tools for writing an assembler? sebastien.fricker@gmail.com (=?ISO-8859-1?Q?S=E9bastien_Fricker?=) (2014-02-24) |
Re: Best tools for writing an assembler? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-02-24) |
Re: Best tools for writing an assembler? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-02-24) |
Re: Best tools for writing an assembler? lkrupp@pssw.com (Louis Krupp) (2014-02-24) |
Re: Best tools for writing an assembler? ivan@ootbcomp.com (Ivan Godard) (2014-02-24) |
[11 later articles] |
From: | "BartC" <bc@freeuk.com> |
Newsgroups: | comp.compilers |
Date: | Sat, 22 Feb 2014 00:28:19 -0000 |
Organization: | virginmedia.com |
References: | 14-02-018 14-02-021 14-02-023 |
Keywords: | assembler |
Posted-Date: | 22 Feb 2014 14:42:00 EST |
"Robert A Duff" <bobduff@TheWorld.com> wrote in message
> 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.
I've gone the other way, from generating machine code (or my own
object code) directly, to now generating assembly source code. Then I
can leave all that side of it to (in my case) NASM, to worry about
object and executable file formats, and instruction encodings.
The inefficiency is not really an issue any more (for inefficient and
bloated text files try HTML and XML).
If the resulting code was not needed for a standalone executable or
for libraries, then maybe a function-based scheme could work well,
although to examine the output, you might still want a familiar
assembly-like text format.
--
Bartc
Return to the
comp.compilers page.
Search the
comp.compilers archives again.