摘要
NDQJava2语言是在NDQJava语言的基础上,增添量子条件语句、量子循环语句、量子子程序、量子模块和量子异常处理机制等多种量子成分而成的一种混成式、结构化、命令式量子程序设计语言。在简述NDQJava2处理系统之后,着重介绍了其词法分析程序及语法分析程序,其中用直接转向法进行词法分析,识别出单词,生成单词序列,用递归子程序法进行语法分析,生成语法树。由示例可知,程序结果无误,较好地完成了词法分析与语法分析任务。
NDQJava2 is a hybrid, structured and imperative quantum programming language, which is an extension of NDQJava with some additional quantum components, such as quantum conditional statement, quantum loop statement, quantum subprogram, quantum module and quantum exception handling mechanism. After briefly stating the NDQJava2 processing system, this paper focuses on the lexical analyzer and the syntactic analyzer, which uses direct steering method for lexical analysis, identifies the words then generates a sequence of words, uses recursive subroutine method for syntax analysis, generates syntax tree. The example shows that the result of this process is correct, fulfills lexical analysis and syntax analysis tasks.
出处
《计算机科学与探索》
CSCD
2013年第6期562-569,共8页
Journal of Frontiers of Computer Science and Technology