Is the F # compiler a one-pass compiler?

I look around the Internet and only find 1 mention of F # using one compilation on a personal blog, and not in official docs.

From my experience, it still seems that F # uses a single pass compilation, so that you can only refer to types or functions that were previously defined in the file that you are currently located in or displayed in the file that is listed earlier in order compilation.

Is this statement true?

+5
source share
1 answer

You need to determine what “passage” means in order to answer this question.

Many compilers are the so-called "phase" ones, which means the various steps of converting the source text into executable machine code or IL code.

I think the term “pass” is outdated and refers to very early compilers that may have already read the actual source files during their processing, real commercial class compilers almost certainly do not or should not.

For example, I worked on the PL / 1 (aka PL / I) compiler for Windows many years ago and went through several steps:

  • parse - destroy the source file and create a parsing tree
  • declarations - allow identifiers in the parse tree to declared names
  • optimize - analyze the parse tree and optimally restructure it.
  • codegen - analyze the parse tree and generate the OBJ file.

Most compilers today do pretty much this (whether in separate phases or not, but they do the same job).

0
source

Source: https://habr.com/ru/post/1266837/


All Articles