有哪些工具可用于解析 Javascript 并读取 Javascript 或 Ruby 中的结果?

发布于 2024-10-02 11:34:17 字数 455 浏览 1 评论 0原文

我想做一些 Javascript 代码分析。我更喜欢在 ASTS-Expression。尽管我似乎找不到任何文档,但 V8 引擎当然有可能构建此内容关于如何从 Javascript 上下文访问此信息。

我非常乐意在 Ruby 中进行分析,尽管我能想到的唯一方法是在 Treetop 或类似的解析器生成器。

I'd like to do some code-analysis of Javascript. I'd prefer to operate on ASTs or S-Expressions. It's certainly possible that the V8 engine builds this, though I can't seem to find any documentation on how to access this information from a Javascript context.

I'd be perfectly happy to do my analysis in Ruby, though the only way I can think of doing that would be to write an entire grammar in Treetop or a similar parser-generator.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

再见回来 2024-10-09 11:34:17

如果您想使用 Ruby,则不必自己实现它,因为 nokogiri 出名的 Aaron Patterson 已经在 rkelly。

If you want to use Ruby you don't have to implement it yourself because Aaron Patterson of nokogiri fame already did in rkelly.

江心雾 2024-10-09 11:34:17

我们的 DMS 软件重组工具包 能够解析 ECMAScript(甚至嵌入 HTML 脚本标记中)或 ONxxx 属性),并构建 AST。您可以定义自己的分析程序,使用源代码级模式来识别代码或转换代码;这些操纵 AST。转换后,您可以重新生成有效的源文本,包括注释。
如果需要,您可以将 AST 作为 XML 导出为另一种语言,但 DMS 包含许多有用的机制来支持程序分析和转换,我相信当您仔细观察时,诱惑就会消失。

DMS 也适用于多种其他语言。

Our DMS Software Reengineering Toolkit is capable of parsing ECMAScript (even embedded in HTML script tags or ONxxx attrbutes), and building ASTs. You can define your own analysis procedures, use source-level patterns to recognize code or transform the code; these manipulate the ASTs. After transformation, you can regenerate valid source text, including comments.
You can export the ASTs to another language as XML if you want, but DMS contains so much useful machinery to support program analysis and transformation that I believe that temptation will go away when you look closely.

DMS works for a wide variety of other languages, too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文