摘要
LR分析器及其语法制导的翻译方法是编译原理课程教学中的重要内容,其分析器的内部结构复杂,工作原理很难被学生直观地理解和掌握。描述一个在Windows平台上独立开发的可视化、交互式的LR分析器动态仿真软件工具。该工具的新颖之处在于它实现了众多高层概念的可视化,支持LR分析器的单步执行和仿真,并允许为产生式附加断点,特别是允许断点插入在产生式右部的任意文法位置。此工具已应用于编译原理的课程教学,亦可用于开发、编写和调试以YACC为代表的LALR(1)分析器生成系统的输入文法规约。
Abstract: Compiler projects frequently use parser generators to help students design and construct non-trivial translators. Unfortunately, the code and data structures produced by such generators, and hence the overall parser, can be difficult to understand and debug. An extendible and flexible tool for visualizing the operation of generated parsers was presented. The tool is superior to other parser visualization products by virtue of the high-level facilities it offers and the step by step simulation of the generated parser as well as breakpoints attached to grammar productions, especially the ability to insert breakpoints into any positions at the right hand side of a production. It was initially designed to be used in compiler construction courses to supplement the teaching of parsing and syntax directed translation. It is also found that the tool is very effective and useful in the difficult task of debugging YACC-like LALR (1) grammars.
出处
《系统仿真学报》
CAS
CSCD
北大核心
2009年第7期1866-1869,共4页
Journal of System Simulation
基金
国家自然科学基金(60573084
60703057)