摘要
针对目前逻辑表达式求值算法中运算符的名称、优先级和运算规则都以硬编码的形式固化在算法中所带来的算法无法扩展的问题,通过将运算符的名称、优先级和运算规则抽象为接口的方法,设计并实现了一种新的逻辑表达式求值系统。该系统既保证了表达式求值算法的独立性,又允许用户自定义运算符和更新原有运算符运算规则,从而实现了逻辑表达式求值的可扩展性。
Aiming at the problem that operator's name, priority, and operation rule are hard-coded in the expression evaluation algorithm, which causes the algorithm can't be expanded, a novel method is proposed, which makes operator's name, priority and operation rule as a interface, and a novel expression evaluation is designed and implemented, which the independence of ex pression evaluation algorithm is supported, and user can customize operator and update the operation rule of the original opera tor, and thus the expansibility of logical expression evaluation is achieved.
出处
《计算机工程与设计》
CSCD
北大核心
2012年第10期3858-3861,3958,共5页
Computer Engineering and Design
基金
国家自然科学基金项目(61071193)
关键词
逻辑表达式求值
中缀表达式
后缀表达式
运算符
接口
扩展性
logical expression evaluation
infix expression
postfix expression
operator
interface
expansibility