共查询到19条相似文献,搜索用时 796 毫秒
1.
董春 《计算机应用与软件》1985,(1)
本文提出了构造优化和加速LR(K)语法分析器的一个新算法。它作为多功能LR语法分析器自动构造系统——XYZ/PG的主体,已用PASCAL语言在NORD-500型计算机上实现。与目前堪称最优的Pager算法相比较,本文算法通常可得到体积更小的LR(K)语法分析器。 相似文献
2.
LR分析法在词法分析器自动构造中的应用 总被引:9,自引:2,他引:7
提出了一种新的自动构造编译程序词法分析器的方法,LR分析法通常用于语法分析,但只要适当修改LR分析总控程序,就可将LR分析法用于词法分析器的自动构造。该方法的优点不仅在于将词法分析器自动构造方法与语法分析器自动构造方法统一,简化了编译程序的设计和构造,而且该方法自动化程序较高,只要确定描述单词的文法和词形编码表,便可自动生成任何程序设计语言编译程序的词法分析器。 相似文献
3.
董春 《计算机研究与发展》1986,(6)
:本文详细地讨论了正则LR(K)分析表(canonical LR(K)parsing table)与优化LR(K)分析表之间的转换关系,并在这一讨论的基础上提出了构造优化和加速LR(K)语法分析器的一个新算法。同时,文中给出了算法的正确性证明。作为多功能LR语法分析器构造系统——XYZ/PG的主体,本文算法已用PASCAL语言在NORD-500型计算机及DAUL 68000微型计算机上实现。与目前堪称最优的Pager算法相比本文算法通常可得到体积更小的LR(K)语法分析器。 相似文献
4.
一、前言LR分析算法是knuth 1965年首先提出的.LR分析器能自动生成,运行效率高,查错功能强,识别语法类大,可用于大多数由上下文无关文法描述的程序语言.然而,由于一般的LR分析器状态数量极多,需要大量的存储空间,很不实用.为此,人们做了许多努力.以后演变出的SLR、LALR文法都是对LR文法加以某种限制,所识别的文法类是LR文法的一个子集,因此可以比较有效地实现. 相似文献
5.
在编译器的构造中,常由于语义的二义性等问题导致不正确的目标程序.为解决此问题,提出了一种新型的语法及语义正确性验证方案,即建立LR (k)文法和Z规格说明的联系,以此构造LR (k)文法的形式化描述及其形式化验证.实验结果表明,该方案能有效描述并检测LR (k)文法分析器中的语法错误及语义二义性,有助于提高分析器的有效性. 相似文献
6.
7.
阐述了在程序设计语言语法分析器的构造中采用通用LR(generalized LR,简称GLR)分析算法的动机.提出了一个多层次的优化策略,加快了GLR分析器的分析速度.为基本的GLR算法增加了必要的运行时控制机制,以实现语法分析时调用文法规则附带的语义动作,化解输入串的二义性,同时避免GLR分析器可能存在的语义动作延迟问题.优化后的算法已在一个可视化语法分析器自动生成环境VPGE中实现.实验结果表明,在分析确定性的编程语言时,自动生成的GLR分析器的分析速度与自由软件基金会的Bison生成的LALR(1)分析器的分析速度有可比性. 相似文献
8.
LR分析技术以其自身的优点在实际当中有着非常广泛的应用,但是,能够识别LR(1)语言的规范LR分析器由于其下推自动机的复杂性,其实用性受到比较大的限制.通过回朔下推自动机的状态迁移路径能够从根本上解决这一问题.主要讨论了基于状态回朔技术的规范型LR分析器的基本原理与构造技术. 相似文献
9.
本文提出了自动构造增量式LR(1)句法分析器的一个有效方法.用该方法构造得到的分析器不仅允许对原语句作多处修改,而且还允许奠基的LR(1)文法含有右边为空的产生式。为了分析一个经过修改的语句,它们所需的空间和时间分别与该语句的长度和所作修改的总和形成线性比.为了进行实验,本方法已在Motorola-68010机上获得实现。 相似文献
10.
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.
《IEEE transactions on pattern analysis and machine intelligence》1981,(3):274-278
LR is an LR(1) parser generation system. It is written entirely in portable ANS1 standard Fortran 66 and has been successfully operated on a number of computers. LR uses a powerful algorithm of Pager's to generate a space efficient parser for any LR(1) grammar. Generated parsers have been used in a variety of compilers, utility programs, and applications packages. 相似文献
13.
A shift-reduce parser for probabilistic context-free grammars is described, based on the LR algorithm. Each of the standard types of LR parser generator has a probabilistic version and a Bayesian interpretation is advanced. A graph-structured stack permits action conflicts and allows the parser to be used with uncertain input, typical of speech recognition applications. The sentence uncertainty is measured using entropy and is found to be significantly lower for the grammar than for a derived first-order Markov model. 相似文献
14.
提出并实现了一种基于神经网络的GLR(Generalized LR)句法分析算法,该算法结合神经网络自学习、自组织和并行分布处理等优点,以BP神经网络结构模型取代了GLR算法的分析表,模拟其移进和归约动作,通过计算网络输出来分析句法结构。该分析算法较好地解决了GLR算法对于存在多个移进归约冲突动作时,复制分析栈会使得动作表变得很大的缺点,实验结果表明,这种算法具有较好的泛化能力。 相似文献
15.
There has been a recent effort in the literature to reconsider grammar-dependent software development from an engineering point of view. As part of that effort, we examine a deficiency in the state of the art of practical LR parser table generation. Specifically, LALR sometimes generates parser tables that do not accept the full language that the grammar developer expects, but canonical LR is too inefficient to be practical particularly during grammar development. In response, many researchers have attempted to develop minimal LR parser table generation algorithms. In this paper, we demonstrate that a well known algorithm described by David Pager and implemented in Menhir, the most robust minimal LR(1) implementation we have discovered, does not always achieve the full power of canonical LR(1) when the given grammar is non-LR(1) coupled with a specification for resolving conflicts. We also detail an original minimal LR(1) algorithm, IELR(1) (Inadequacy Elimination LR(1)), which we have implemented as an extension of GNU Bison and which does not exhibit this deficiency. Using our implementation, we demonstrate the relevance of this deficiency for several real-world parser specifications, and we demonstrate the feasibility of IELR(1). Finally, we demonstrate that, if canonical LR(1) were employed instead, grammar development would be severely impeded regardless of the power of the computer hardware. 相似文献
16.
《国际计算机数学杂志》2012,89(3):189-206
The paper is the third in a series of three papers devoted to a detailed study of LR(k) parsing with error recovery and correction. A new class of syntax errors is introduced, called (k)-local parser defined errors, which suit better than the conventional minimum distance errors for characterization of error detection and recovery in LR(k) parsing. The question whether a given string has n k-local parser defined errors for some integer n is shown to be decidable. Using the formalization of LR(k) parsing and error recovery presented in the first and the second paper in the series it is shown that the canonical LR(k) parser of an LR(k) grammar always has an error recovering extension which is able to produce a correction for any terminal string containing only (k)-local parser defined errors. 相似文献
17.
《国际计算机数学杂志》2012,89(4):287-295
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. 相似文献
18.
Conventional LR parser generators create tables which are used to drive a standard parser procedure. Much faster parsers can be obtained by compiling the table entries into code that is directly executed. A possible drawback with a directly executable parser is its large size. In this paper, we introduce optimization techniques that increase the parsing speed even further while simultaneously reducing the size of the parser. 相似文献
19.
Esko Ukkonen 《Information Processing Letters》1985,20(2):99-103
It is shown that in many cases the trivial upper bound 2|G|k + 1 on the number of states of an LR(k) parser for a grammar G is too conservative. In particular, if G is not right-recursive, the canonical LR(k) parser for G has at most |Gk|G|·2|G| states. Examples of grammars with large LR(k) parsers are given. 相似文献