检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:王国隆 金大海[1] 宫云战[1] WANG Guolong;JIN Dahai;GONG Yunzhan(State Key Laboratory of Networking and Switching Technology,Beijing University of Posts and Telecommunications,Beijing 100876,China)
机构地区:[1]北京邮电大学网络与交换技术国家重点实验室,北京100876
出 处:《计算机测量与控制》2022年第2期151-159,共9页Computer Measurement &Control
基 金:国家自然科学基金(U1736110)。
摘 要:随着C++语言标准的不断演进,词法语法解析工具如JavaCC等对于很多扩充的新特性以及复杂的语法结构不能做到完全支持,这可能会导致抽象语法树生成错误且不完整;针对这一问题,提出一个针对抽象语法树生成错误的处理框架;首先,通过对JavaCC的扩充,实现一套可以解析C++语言的词法语法分析器,生成抽象语法树并记录报错行;其次,根据报错行寻找所在函数区间即不支持或不匹配的语法片段;最后,通过注释函数区间的方式来跳过不支持或不匹配的语法片段进行错误处理并迭代生成抽象语法树;实验结果表明,对抽象语法树生成进行错误处理后可以更全面的分析代码,抽象语法树完成率上升37.8%,分析行数提高3.9倍。With the continuous evolution of C++language standard,lexical parsing tools such as JavaCC cannot fully support many expanded new features and complex grammatical structures,which may lead to incorrect and incomplete abstract syntax tree generation.Aiming at this problem,an errors processing framework generated by abstract syntax trees is proposed.Firstly,through the extensible JavaCC,a set of lexical parsers that can parse C++compiler are implemented,the abstract syntax trees and record error lines are generated.Secondly,look for the grammatical fragments that are not supported or matched in the function range according to the error line.Finally,By annotating the function intervals,the skip unsupported or unmatched grammar fragments for error handling and iteratively generate an abstract syntax tree.The experimental results show that the code can be analyzed more comprehensively after the error processing of the abstract syntax tree generation.The abstract syntax tree completion rate increases by 37.8%,and the number of analysis lines improves by 3.9 times.
关 键 词:抽象语法树 C++程序 JavaCC解析工具 语法变更 错误处理
分 类 号:TP311[自动化与计算机技术—计算机软件与理论]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.49