Difference between one pass and multi pass compilers?

后端 未结 6 1070
逝去的感伤
逝去的感伤 2021-02-06 03:24

I have seen a lot of posts regarding one pass and multi pass compilers but i dont seem to get the point.

  • What are one

6条回答
  •  别跟我提以往
    2021-02-06 03:39

    A pass in a compiler is nothing but going through the entire program once from top to bottom

    .Often a pass will consist of several phases.Generally one pass is enough for both lexical and syntax analysis to get completed.That means by going through the entire program once ,we can check whether a statement is syntactically correct or not.And then the output of a syntax analysis is an Abstract syntax tree,which is nothing but the source code(condensed) in the form of a tree.The semantic analyser has to go through the AST to do its work and there by effectively going through the entire program once more. That is to complete Semantic analysis two passes are required.(if an explicit AST is required).

提交回复
热议问题