什么是JavaScript AST,如何玩它? [英] What is JavaScript AST, how to play with it?

查看:254
本文介绍了什么是JavaScript AST,如何玩它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抽象语法树..我总是听说在Github上编译为SpiderMonkey AST。

那么,这是JS语法树的实际标准吗?还有V8,是V8使用相同类型的AST吗?

Abstract Syntax Tree.. I always heard that compile to SpiderMonkey AST on Github.
So, is that a actual standard of JS syntax tree? And there's V8, is V8 using the same kind of AST?

我该怎么玩?

推荐答案

SpiderMonkey提供解析器API 。这可能是获取语法对象的最简单方法。

SpiderMonkey offers the parser api. This is probably the easiest way to get your hands on the syntax objects.

还有 js-js 解析器,如Esprima (这是ECMAScript,真的,但它就在巷子里)

There's also open js-js parsers like Esprima (which is ECMAScript, really, but it's right up the alley)

这篇关于什么是JavaScript AST,如何玩它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆