首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到19条相似文献,搜索用时 117 毫秒
1.
LR分析技术以其自身的优点在实际当中有着非常广泛的应用,但是,能够识别LR(1)语言的规范LR分析器由于其下推自动机的复杂性,其实用性受到比较大的限制.通过回朔下推自动机的状态迁移路径能够从根本上解决这一问题.主要讨论了基于状态回朔技术的规范型LR分析器的基本原理与构造技术.  相似文献   

2.
基于神经网络语法分析   总被引:2,自引:0,他引:2  
文章提出了基于神经网络理论适用于LR文法的语法分析,与传统LR分析器相比,神经网络LR分析器具有较高的性能。  相似文献   

3.
张惠艳 《福建电脑》2010,26(1):205-206
以一个典型的四则运算的文法为例,采用倒叙的讲解方法,系统地介绍了使用LR分析表的构造过程和语法分析器的构造方法,简化了鳊译程序的设计和构造。  相似文献   

4.
LR分析法在词法分析器自动构造中的应用   总被引:9,自引:2,他引:7  
温敬和 《计算机工程》2001,27(7):188-190
提出了一种新的自动构造编译程序词法分析器的方法,LR分析法通常用于语法分析,但只要适当修改LR分析总控程序,就可将LR分析法用于词法分析器的自动构造。该方法的优点不仅在于将词法分析器自动构造方法与语法分析器自动构造方法统一,简化了编译程序的设计和构造,而且该方法自动化程序较高,只要确定描述单词的文法和词形编码表,便可自动生成任何程序设计语言编译程序的词法分析器。  相似文献   

5.
肖洋  姜淑娟 《计算机工程》2007,33(4):193-195
语法分析中的错误恢复是现代编译器中智能感知功能的重要组成部分,错误恢复的效果直接影响到智能感知功能的性能。在分析LR语法分析中LR分析表特性的基础上,提出了一种对LR分析表中的Goto表项进行改造来进行语法错误的诊断和恢复的方法。该方法充分利用了LR分析表中的空闲表项,在不增加空间需求的情况下,提高了语法错误的诊断和恢复的效率和准确率。  相似文献   

6.
LR分析法是编译原理课程的重点和难点之一。本文对LR分析法的教学内容和教学方法进行了简化,避开了部分抽象概念的讲解,以一种较简洁和直观的方式帮助学生理解LR分析法的原理和技术。  相似文献   

7.
本文给出了一种应用LR分析法错误恢复方法,介绍LR分析法格局,并引入语法分析延迟技术,给出语法分析恢复的三个过程,即简单恢复、区域恢复和辅助恢复。  相似文献   

8.
B.J.McKNZIE  励小 《软件》1991,(1):60-68
本文给出一种扩充LR分析方法以使其能够处理含有嵌套限制的上下文无关文法之办法。在基于LR的分析程序中,通常要借助执行LR方法的上下文以外的语义代码处理这样的限制,由于LR方法本身就含有这样的限制,所以潜在的移动归纳与归约归约的冲突可被解决并能进一步制约认可的语言,推荐的方法很蝗于并入现有的基于LR的分析程序生成系统。  相似文献   

9.
程序设计语言的GLR优化分析   总被引:1,自引:0,他引:1       下载免费PDF全文
李虎  金茂忠  许福  张敏 《软件学报》2005,16(2):174-183
阐述了在程序设计语言语法分析器的构造中采用通用LR(generalized LR,简称GLR)分析算法的动机.提出了一个多层次的优化策略,加快了GLR分析器的分析速度.为基本的GLR算法增加了必要的运行时控制机制,以实现语法分析时调用文法规则附带的语义动作,化解输入串的二义性,同时避免GLR分析器可能存在的语义动作延迟问题.优化后的算法已在一个可视化语法分析器自动生成环境VPGE中实现.实验结果表明,在分析确定性的编程语言时,自动生成的GLR分析器的分析速度与自由软件基金会的Bison生成的LALR(1)分析器的分析速度有可比性.  相似文献   

10.
本文探讨如何在"编译原理"教学过程中形象地演示复杂的算法过程,提出了一个演示算法步骤的方案,展示算法步骤的进行以及步骤进行时的数据联动,对于不同的动作、不同意义的数据,用图形元素和颜色加以区分,并以LR分析算法为例说明了如何分解复杂步骤,如何用图形和颜色展示移进、归约、接受、出错等分析动作以及相关数据的变化。  相似文献   

11.
Parallel parsing is currently receiving attention but there is little discussion about the adaptation of sequential error handling techniques to these parallel algorithms. We describe a noncorrecting error handler implemented with a parallel LR substring parser. The parser used is a parallel version of Cormack's LR substring parser. The applicability of noncorrecting error handling for parallel parsing is discussed. The error information provided for a standard set of 118 erroneous Pascal programs is analysed. The programs are run on the sequential LR substring parser.  相似文献   

12.
H. Mssenbck 《Software》1988,18(7):691-700
We present a simple method for connecting semantic actions to parsers. Although applicable to any kind of parser it is especially suited for LR parsers. The method is based on the idea of separating syntax analysis and semantic processing and executing semantic actions by procedures, similar to those of a recursive descent compiler. The procedures are driven by structural information about the source program, which is collected during parsing. The method is applicable to L-attributed grammars. It can be incorporated easily into any existing parser.  相似文献   

13.
This paper addresses two of the problems commonly associated with LR parsing and syntax directed translation schemes, namely grammar stratification and excessively large table size, A solution is discussed which can eliminate stratification of the grammar by allowing the designer to embed semantics directly within the LR table (i.e., at shift and error entries instead of just at reduce entries) and to use global context to determine what semantics should be performed. The non-stratified grammar can produce a significantly smaller LR table than the corresponding stratified grammar. The compatibility of this scheme with commonly used table compaction techniques is also discussed.  相似文献   

14.
编译原理课程的教学不仅要介绍编译的基本原理和技术,还要培养学生的学习兴趣、专业思维和科学研究的方法及能力,文章以LR类分析方法为例,以还原知识的发现过程为主线,重现解决问题的思路与方法,以期培养学生的专业学习兴趣和科研能力。  相似文献   

15.
Extended context-free grammars allow regular expressions to appear in productions right hand sides, and are a clear and natural way to describe the syntax of programming languages.In this paper an LR parsing technique for extended context-free grammars is presented, which is based on an underlying transformation of the grammar into an equivalent context-free one.The technique is suitable for inclusion in one-pass compilers: the implementation requires little extensions to the algorithms working for normal LR grammars. Besides describing the parsing method, the paper shows also the algorithms for deriving the parsing tables; tables optimization is also discussed. Finally, this technique is compared with other proposals appeared in the literature.  相似文献   

16.
17.
LR(k)文法能描述所有确定型上下文无关语言,广泛应用于各类分析器生成器中.传统的LR(k)文法断点调试方法仅支持在产生式右部末尾设置断点(后文简称尾部断点),不支持在产生式右部中间位置设置断点(后文简称中间断点),这给分析器的开发和调试带来了不便.文中提出了一种新颖的LR(k)文法断点调试方法,不但支持传统的尾部断点,还支持中间断点.该方法可显著增加可利用的断点数量,可以跟踪到更细粒度的文法成分,从而帮助用户更好地进行文法调试,降低分析器的开发难度.  相似文献   

18.
One of the difficult problems that faces a compiler writer is to devise a grammar that is suitable for both efficient parsing and semantic attribution. This paper describes a system that resolves conflicts in LR(1) parsing by taking advantage of information in the parse tree. The system, which functions as part of a compiler generator, rewrites the user's grammar to remove parsing conflicts. It then places code into the generated compiler that rewrites the parse tree during parsing so as to produce the tree of the original grammar. The compiler writer can then write the semantic attribution to fit his or her original grammar without any knowledge of the changes made. The method is expected to be efficient in most cases, even in parsing systems that do not explicitly build the entire parse tree. The method complements previous work in its capabilities and advantages. The system has been implemented and integrated into a compiler generator system.  相似文献   

19.
It is shown that if the basic method for eliminating single productions from canonical LR parsers developed by Pager is applied to an SLR parser and the resulting parser is free of conflicts, then the resulting parser is a valid parser which accepts exactly the strings in the language. However, if the elimination process is performed during the construction of an SLR parser, then the resulting parser may be invalid even if it were free of conflicts.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号