Author Login Editor-in-Chief Peer Review Editor Work Office Work

Computer Engineering

Previous Articles     Next Articles

JavaScript Code Recommendation Based on Dynamic Analysis

WU Tong,CHEN Yu-ting   

  1. (School of Software,Shanghai Jiaotong University,Shanghai 200240, China)
  • Received:2013-11-06 Online:2014-10-15 Published:2014-10-13

基于动态分析的JavaScript 代码推荐

吴 通,陈雨亭   

  1. (上海交通大学软件学院,上海200240)
  • 作者简介:吴 通(1988 - ),男,硕士研究生,主研方向:程序语言分析;陈雨亭,讲师。
  • 基金资助:
    国家自然科学基金资助项目(61272102,61100051)。

Abstract: Aiming at the problem of low precise and slow response in the state of JavaScript code recommendation technology,this paper introduces a JavaScript code recommendation method based on dynamic analysis and implements a code recommendation plug-in for Eclipse. This approach builds model offline for storing the simulated runtime environment,and creates indexes for all objects in the environment. It simulates executing user code,while applying abstract syntax tree of user code for blocking and updating undefined variables at runtime,to achieve a JavaScript code recommendation tool based on dynamic a nalysis. Compared with current code proposal tools with static analysis, experiments show the tool improves both the precise and response time.

Key words: code recommendation, Eclipse plug-in, dynamic analysis, abstract syntax tree, simulated execution, exception handling

摘要: 针对现有基于静态分析的JavaScript 代码推荐技术准确度低且响应速度较慢的问题,提出一种基于动态分析的JavaScript 代码提示方法,并设计基于Eclipse 插件的代码推荐工具。采用事先建模的方法保存模拟运行环境,并且对上下文对象建立特征索引。同时在用户代码抽象语法树的基础上进行代码分块,按程序分块顺序对用户代码进行模拟执行,利用对象之间的相似度在用户运行时修正运行变量,并对模拟执行时产生的异常进行处理,实现针对用户代码的动态分析JavaScript 代码提示。实验结果表明,与现有使用静态分析方法的JavaScript 代码推荐技 术相比,该方法具有更高的可推荐性和更快的响应速度。

关键词: 代码推荐, Eclipse 插件, 动态分析, 抽象语法树, 模拟运行, 异常处理

CLC Number: