Re: Best tools for writing an assembler?

=?ISO-8859-1?Q?S=E9bastien_Fricker?= <sebastien.fricker@gmail.com>
Fri, 21 Feb 2014 12:00:43 +0100

          From comp.compilers

Related articles
[2 earlier articles]
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)
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)
[13 later articles]
| List of all articles for this month |

From: =?ISO-8859-1?Q?S=E9bastien_Fricker?= <sebastien.fricker@gmail.com>
Newsgroups: comp.compilers
Date: Fri, 21 Feb 2014 12:00:43 +0100
Organization: Guest of ProXad - France
References: 14-02-018 14-02-021 14-02-023
Keywords: assembler
Posted-Date: 22 Feb 2014 14:40:28 EST

On 20/02/2014 00:20, Robert A Duff wrote:
> 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.
>


This is certainly the most important decision.
The tools/language used cannot be switched during the development.


I wrote a parser for C++ code in C and Flex/Bison. Due to the
difficulty to program complex C code, I have migrated my code to C++.
The code get 20% smaller (due to all free() and low level functions
which are no more necessary) and the code get easier to understand.
The STL contains was also permitting to implement high level
optimization and also reducing the complexity of the algorithms. Doing
this in C is more difficult.


Now, I would write the same in OCaml because:
  - The type checking is very good
  - Menhir (replacement of Flex/Bison) exists
  - The source code would be smaller without syntax glue (like the
necessity to have heaer, ....)
  - Easy possibility to program complex algorithm in few lines.
  - The OCaml code is only 2 times slower that C code (which is acceptable)
  - The startup code (time nead to reach main) is similar to C++.


But migrating an existing project is not possible.
In other words: it makes sense to take time to choose the right
framework at the beginning.


Post a followup to this message

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