Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: About compiler optimizations

Author: Matt Taylor

Date: 22:48:35 12/21/02

Go up one level in this thread


I couldn't resist posting, even if I just reiterate what others have already
said.

On December 21, 2002 at 21:20:26, Vincent Diepeveen wrote:

>On December 21, 2002 at 17:45:43, Matt Taylor wrote:
>
>>On December 21, 2002 at 17:29:11, Vincent Diepeveen wrote:
>>
>>>On December 21, 2002 at 14:32:18, Matt Taylor wrote:
>>>
>>>checkout the compiler faq at :
>>>
>>>http://www.cs.strath.ac.uk/~hl/classes/52.358/FAQ/passes.html
>>>
>>>[off topic nonsense removed]
>>
>>Ok, the FAQ explains to me principles which were self-evident. When you read the
>>FAQ, you realize that an optimizing single-pass C compiler is not possible.
>>
>>"Optimization: Only really possible with a multi-pass compiler"
>>
>>It also reaffirms what I'd already stated -- multi-pass compilers are EASIER to
>>write because the code is more modular and has less coupling. Just about the
>>only data structure that you're going to rely on to go between stages is the
>>AST, and that's not that difficult.
>>
>>This is quite familiar for me as I've been working on a compiler implementation
>>for a C-like language. (Actually it's more like C++, but it lacks multiple
>>inheritance and templates.)
>>
>>-Matt
>
>If you have 'so much' experience with compilers, whereas i consider myself
>a layman; i just wrote a few very very primitif compilers (and no assembly
>output of them even); i wonder why you do not know what 'single pass
>compiler' means. It has to do with how many times a compiler reads
>the source code. Not so much how many high level optimizations
>you apply to it.

1. I don't claim to be an expert; I claim to be intelligent, capable of
learning, and capable of making educated decisions based on what I already know.
2. No. I double-checked the definition. A pass is made every time you traverse
the code be it in AST form or whatever. Eugene's comment was much more elegant
than mine, so I won't elaborate any further.

I will also add that I have never even taken a formal compiler course.

The question of design here is really quite simple. Do you parse, validate
syntax, and optimize all at the same time, or do you do it in stages?

It should be obvious, even to a layman, that seperating these stages
significantly reduces the problem, and reducing the complexity of the code will
cause you fewer bugs.

>So now you learned again something.

I learned that you really like the taste of your toes.

-Matt



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.