We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
为了可靠地修改源代码,您几乎需要能够像编译器一样解析它,使用该语言的标准作用域规则指向语言实体,并说明对代码的更改。执行此操作的工具称为程序转换引擎。
提供与生产质量语言前端集成的所有这些编译器机制是一项相当大的工作,因此周围没有很多这样的工具。
请参阅我们的 DMS 软件重组工具包。这是一个程序转换引擎,可以处理多种语言(C、C++、C#、Java、PHP、JavaScript...)并支持此类工作。像 DMS 这样的源到源样式转换引擎的一个很好的特性是能够编写转换使用您想要操作的语言的(表面)语法,而不是更传统的纯编译器之类的工具,这些工具要求您简单地使用大量过程代码来破解抽象语法树。
这并不像“哦,改变这个”那么容易。但靠谱吗。
编辑 6/23/2011:OP 说它必须与 Java 和 PHP 一起工作。 DMS 确实如此。
To modify source code reliably, you pretty much need to be able to parse it the same way a compiler does, point at language entities using the standard scoping rules for that language, and state your changes to the code. Tools that do this are called program transformation engines.
To provide all this compiler machinery integrated with production quality language front ends is considerable work so there aren't a lot of these tools around.
See our DMS Software Reengineering Toolkit. This is a program transformation engine that handles multiple languages (C, C++, C#, Java, PHP, JavaScript, ...) and enables this kind of work. A nice property of a source-to-source style transformation engine like DMS is the ability to write transformations using the (surface) syntax of the langauge(s) you want to manipulate, rather than more traditional pure-compiler like tools that insist you simply hack at an abstract syntax tree with lots of procedural code.
It isn't as easy is "oh, just change this". But is it reliable.
EDIT 6/23/2011: OP said it had to work with Java and PHP. DMS does.
还有一个名为 Comby 的工具(https://comby.dev/),它标榜自己是“一个工具”用于搜索和更改代码结构”。
来自 这篇解释 Comby 要点的博文,这是一个屏幕截图comby.live 游乐场中的用法示例:
There is also the tool named Comby (https://comby.dev/), which bills itself as "a tool for searching and changing code structure".
From this blog post explaining the gist of Comby, here is a screenshot of an example usage in the comby.live playground: