作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2007, Vol. 33 ›› Issue (04): 193-195. doi: 10.3969/j.issn.1000-3428.2007.04.067

• 人工智能及识别技术 • 上一篇    下一篇

一种LR语法分析中的错误恢复方法

肖 洋,姜淑娟   

  1. (中国矿业大学计算机科学与技术学院,徐州 221008)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2007-02-20 发布日期:2007-02-20

An Error Recovery Approach in LR Syntax Analysis

XIAO Yang, JIANG Shujuan   

  1. (School of Computer Science & Technology, China University of Mining & Technology, Xuzhou 221008)
  • Received:1900-01-01 Revised:1900-01-01 Online:2007-02-20 Published:2007-02-20

摘要: 语法分析中的错误恢复是现代编译器中智能感知功能的重要组成部分,错误恢复的效果直接影响到智能感知功能的性能。在分析LR语法分析中LR分析表特性的基础上,提出了一种对LR分析表中的Goto表项进行改造来进行语法错误的诊断和恢复的方法。该方法充分利用了LR分析表中的空闲表项,在不增加空间需求的情况下,提高了语法错误的诊断和恢复的效率和准确率。

关键词: 语法分析, 编译器, 智能, LR语法分析表, Action-Goto表

Abstract: Error recovery in syntax analysis is one of the most important parts of the intelligence in the compiler. The effect of error recovery influences intelligence and syntax analysis. This paper presents a new method of modifying the items of Goto table in correcting syntax error based on analyzing the items of LR syntax analysis table. It uses the leisure items in LR syntax analysis table. It can improve the efficiency and precision in diagnosing and correcting syntax error without requiring more space.

Key words: Syntax analysis, Compiler, Intelligence, LR syntax analysis table, Action-Goto table