What's the difference between parse tree and AST?

后端 未结 5 1415
我在风中等你
我在风中等你 2020-11-30 18:38

Are they generated by different phases of a compiling process? Or are they just different names for the same thing?

5条回答
  •  生来不讨喜
    2020-11-30 19:20

    The DSL book from Martin Fowler explains this nicely. The AST only contains all 'useful' elements that will be used for further processing, while the parse tree contains all the artifacts (spaces, brackets, ...) from the original document you parse

提交回复
热议问题