本文介绍了有助于重构的编程语言属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以促进(简化)广泛自动化的源代码分析和重新设计(转换)工具开发的编程语言的共同特征/属性是什么?

What are common traits/properties of programming languages that facilitate (simplify) the development of widely automated source code analysis and re-engineering (transformation) tools?

我主要是在考虑使开发静态分析和重构工具更容易的编程语言功能(即比较Java与C ++,前者对重构的支持更好).

I am mostly thinking in terms of programming language features that make it easier to develop static analysis and refactoring tools (i.e. compare Java vs. C++, the former of which has better support for refactoring).

换句话说,一种将被明确设计为从一开始就提供对自动静态分析和重构的支持的编程语言,它最好具有什么特征?

In other words, a programming language that would be explicitly designed to provide support for automated static analysis and refactoring right from the beginning, what characteristics would it preferably feature?

例如,对于 Ada ,有 ASIS :

ASIS信息: ASIS为工具提取最佳数据提供了一种标准方法.由Ada编译器或其他源代码分析器收集.使用ASIS的工具本身是用Ada编写的,可以很容易地在支持ASIS的Ada编译器之间移植.使用ASIS,开发人员可以生产具有高度可移植性的功能强大的代码分析工具.它们还可以节省实施从源程序中提取语义信息的算法的可观费用.例如,已经存在ASIS工具,这些工具可以生成源代码指标,检查程序是否符合编码风格或限制,进行交叉引用以及对程序进行全局分析以进行验证和验证.

ASIS information: ASIS provides a standard way for tools to extract data that are best collected by an Ada compiler or other source code analyzer. Tools which use ASIS are themselves written in Ada, and can be very easily ported between Ada compilers which support ASIS. Using ASIS, developers can produce powerful code analysis tools with a high degree of portability. They can also save the considerable expense of implementing the algorithms that extract semantic information from the source program. For example, ASIS tools already exist that generate source-code metrics, check a program's conformance to coding styles or restrictions, make cross-references, and globally analyze programs for validation and verification.

另请参见, ASIS常见问题解答

您能想到其他的编程语言,它们提供了类似的全面完整的接口来专门处理用于分析/转换目的的源代码吗?

Can you think of other programming languages that provide a similarly comprehensive and complete interface to working with source code specifically for analysis/transformation purposes?

我正在考虑提供低级挂钩的特定实现技术,例如核心库函数,这些函数提供了一种在运行时检查AST或ASG的方法.

I am thinking about specific implementation techniques to provide the low level hooks, for example core library functions that provide a way to inspect an AST or ASG at runtime.

推荐答案

最大的必须是静态键入.这使工具可以更深入地了解代码在做什么.没有它,重构将变得困难很多.

The biggest has to be static typing. This allows tools to have much more insight into what the code is doing. Without it refactoring becomes many times more difficult.

这篇关于有助于重构的编程语言属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-22 07:09