lxinr/interview-question

2021/02/22 - 对AST的理解

Opened this issue · 0 comments

lxinr commented

(Abstract Syntax Tree) 抽象语法树

源代码语法结构的一种抽象表示。它以树状的形式表现编程语言的语法结构,树上的每个节点都表示源代码中的一种结构

是各类代码编译、语法检查、风格检查、自动补全等的基础

function fn() {
  const array = [1, 2, 3]
  return array.map(v => v++)
}

对应的AST https://astexplorer.net/
https://static.lxinr.com/2021/0222/1613986964406.jpeg