计算机科学 ›› 2012, Vol. 39 ›› Issue (Z11): 276-279.
• 数据库与数据挖掘 • 上一篇 下一篇
张广梅,李景霞
出版日期:
发布日期:
Online:
Published:
摘要: 表达式是程序的基本组成单位。在C/C++语言程序中,变量的自增/自减运算造成表达式或函数调用中存在副作用。表达式或函数调用中的副作用会造成程序运行结果的异常,甚至导致系统崩溃。首先对副作用的产生原因进行了分析,进而提出了利用属性文法对具有副作用的表达式或函数调用进行检测的方法,该方法可以有效地完成表达式或函数调用中的副作用的检测。
关键词: 表达式的副作用,函数调用副作用,词法规则,属性文法
Abstract: Expression is a basic unit of a program. There will be side effect while using increasing operator or decreasing operator in an expression or in a function call. If there is side effect in a program,the result of a program will be abnormal, even more, the computer system will be breakdown. In this paper, the reasons that cause the side effect in an expression arc analyzed and the lexical rule and attributed grammar that can detect the side effect in expression or in a function call are provided. By using the lexical analyzer that generated form the lexical rule and the parser analyzer generated from the attributed grammar, the expressions and function calls that contain side effect can be detected.
Key words: Side effect of an expression, Side effect of function call, Lexical rule, Attributed grammar
张广梅,李景霞. 利用属性文法对程序中的副作用进行检测[J]. 计算机科学, 2012, 39(Z11): 276-279. https://doi.org/
0 / / 推荐
导出引用管理器 EndNote|Reference Manager|ProCite|BibTeX|RefWorks
链接本文: https://www.jsjkx.com/CN/
https://www.jsjkx.com/CN/Y2012/V39/IZ11/276
Cited