Representing source code in a generic input format is crucial to automate software engineering tasks, e.g., applying machine learning algorithms to extract information. Visualizing code representations can further enable human experts to gain an intuitive insight into the code. Unfortunately, as of today, there is no universal tool that can simultaneously visualise different types of code representations. In this paper, we introduce a tool, CodeLens, which provides a visual interaction environment that supports various representation methods and helps developers understand and explore them. CodeLens is designed to support multiple programming languages, such as Java, Python, and JavaScript, and four types of code representations, including sequence of tokens, abstract syntax tree (AST), data flow graph (DFG), and control flow graph (CFG). By using CodeLens, developers can quickly visualize the specific code representation and also obtain the represented inputs for models of code. The Web-based interface of CodeLens is available at http://www.codelens.org. The demonstration video can be found at http://www.codelens.org/demo.
翻译:源代码的通用输入格式表示对于自动化软件工程任务至关重要,例如应用机器学习算法提取信息。代码表示的可视化能进一步帮助人类专家直观理解代码。然而时至今日,尚不存在可同时可视化不同类型代码表示的通用工具。本文介绍一款名为CodeLens的工具,它提供支持多种表示方法的可视化交互环境,帮助开发者理解和探索这些表示。CodeLens设计支持Java、Python、JavaScript等多种编程语言,以及包括标记序列、抽象语法树(AST)、数据流图(DFG)和控制流图(CFG)在内的四种代码表示类型。通过使用CodeLens,开发者可以快速可视化特定代码表示,并获取用于代码模型的表示输入。CodeLens的Web界面访问地址为http://www.codelens.org,演示视频参见http://www.codelens.org/demo。