What is difference between phase and pass?

1 answer

Answer

1078942

2026-03-08 10:10

+ Follow

Improve

When we talk about the phases we talk about the steps compiler should do in order to finish it job. For example phases could be creating local variables symbol table, generating parsing tree, lexical checking, optimization, etc.

When we talk about passes we talk about times some operation was repeated. For example there are 2-passes Assembler compilers. It means that before giving the results it repeats some steps twice, most of time times optimization step. The more passes you put the better quality result you get. The same applies to music and video encoding.

For example:

Source code:

i++;

i++;

i++;

1st step (pass):

i = i + 1;

i = i + 1;

i = i + 1;

2nd step (pass):

i = i + 3;

Most of compiler before generating results converts source code some kind inner language that is easier to parse, check in later steps.

As you can see two-pass compiler would generate better quality code, than one-pass compiler, but the first one would be faster to compile.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.