On 25.04 11:53, Dan Sugalski wrote:
At 4:05 AM +0300 4/25/02, Einar Karttunen wrote:
>The reason for the immediate is the optimiser pass and the
>complexity of backends.
>* backends need to only know about the intermediate code not the AST
>* frontends and backends can be switched with no recoding
>* some optimisations common to all backends are very unnatural at
>the AST level
I'll point out that some optimisations common to all backends are
very natural to do at the AST level. Most compilers I know of have at
least three different intermediate representations of the code for
the optimiser because of the different characteristics of the
different optimisations. Some work best with a high-level
representation, some with a medium-level representation, and some
with a low-level representation.
Of course some optimisation is best done in AST level, and I think
my message made it clear. Most compilers I know about have just
two level if you don't count instruction scheduling as a third
level.