Re: Compiler Construction - New to it and getting started.

TOUATI Sid <touati@prism.uvsq.fr>
1 Mar 2005 15:53:25 -0500

          From comp.compilers

Related articles
Compiler Construction - New to it and getting started. NatLWalker@gmail.com (Nate the Capricious) (2005-02-11)
Re: Compiler Construction - New to it and getting started. napi@cs.indiana.edu (2005-02-12)
Re: Compiler Construction - New to it and getting started. torbenm@diku.dk (2005-02-16)
Re: Compiler Construction - New to it and getting started. touati@nospam-prism.uvsq.fr (TOUATI Sid) (2005-02-28)
Re: Compiler Construction - New to it and getting started. torbenm@app-4.diku.dk (2005-02-28)
Re: Compiler Construction - New to it and getting started. touati@prism.uvsq.fr (TOUATI Sid) (2005-03-01)
| List of all articles for this month |

From: TOUATI Sid <touati@prism.uvsq.fr>
Newsgroups: comp.compilers
Date: 1 Mar 2005 15:53:25 -0500
Organization: Universite de Versailles Saint-Quentin-en-Yvelines
References: 05-02-039 05-02-068 05-02-099 05-02-107
Keywords: optimize, courses, OOP

> I don't agree. First of all, most optimization techniques are
> formalized in some way (data-flow analysis, control-flow analysis,
> pattern recognition, etc.) and, secondly, OCaml or SML can be used to
> write ad-hoc code as well as C can. I would actually say they are even
> better at this than C, as you don't have to worry so much about memory
> allocation/deallocation in the compiler and you can often write fairly
> advanced transformations as quick hacks by using pattern matching or
> standard higher-order functions such as fold and map.
>
> Where C may be a better option than OCaml or SML is bytecode
> interpreters. Here, you may want to do bit-fiddling and stuff where
> you treat the same data sometimes as pointers and sometimes as
> integers. This is where C's lack of type enforcement can come in
> handy.
>
> Torben


Torben,
your arguments convinced me. I agree that OCaml can be used as
imperative C language, so it may be used to implement ad hoc compiler
optimization modules.


However, there is another important point : history ! sometimes, many
previous compiler modules are already implemented in C or C++. Reusing
them efficiently may require to use one of these two languages. I think
you would say that OCaml allows to import external modules (as if they
are libraries) ! but we may feel too that reusing C modules is better
done by continuing to use C. All depends on the engineering criteria.
History isn't a weak argument in software engineering : did you try to
persuade physicists to stop using fortran 77 ?


S


Post a followup to this message

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