首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到17条相似文献,搜索用时 93 毫秒
1.
描述了一个VHDL语言词法和语法分析器的设计与实现,采用语法规则描述与分析引擎分离的方法,首先将VHDL语法规则用GPLD元语言描述,然后生成二进制语法分析表。选择所需语言编写分析引擎程序,在对VHDL代码进行分析时,用分析引擎载入生成的分析表,显示分析过程的移进、规约状态步并构建分析树并报告错误。  相似文献   

2.
研究了如何用CONPAR语言对Petri网图形进行描述,来获得Petri网模型对应的等效文本文件;然后设计了由Petri网文本文件到VHDL转换的文法规则及对应的语义动作源文件,并由编译工具YACC自动生成Petri网到VHDL转换的语法分析器;语法分析生成的中间代码是一棵抽象语法树,可以自顶向下遍历此抽象语法树,并按照相应的语义规则,通过比较Petri网文本描述和VHDL代码的差别生成VHDL目标代码;由此实现了Petri网到VHDL的翻译器,为基于Petri网的并行控制器的自动硬件实现提供了一种快速有效的方法。  相似文献   

3.
利用YACC与LEX来完成VHDL语言高级综合前端的词法与语法分析器设计。介绍词法分析模块,语法分析模块以及错误处理模块的设计方法。利用Windows平台卞的Parser Generator 2.0生成词法与语法的C文件,在Visual C++6.0中编译该C文件,生成可执行程序。  相似文献   

4.
LALR(1)语法分析器的自动生成   总被引:2,自引:0,他引:2  
文章简单介绍了语法分析器自动生成的原理和技术,根据语法分析器的生成过程,介绍了实用的语法分析器的自动生成器各个部件及其实现的详细过程。  相似文献   

5.
论文对在设计ATLAS-C语法分析器中YACC工具所无法解决的冲突进行了具体的讨论与研究,并且对出现的冲突提出了相应的解决方案。实验结果证明论文提出的消解冲突的方法在设计语法分析器时具有可行性。  相似文献   

6.
针对大型应用软件中嵌入脚本语言问题,提出了一种快捷而通用的语法分析器设计与实现方法。建立了脚本语言文法的描述规范;设计并实现了语法分析的算法。实例表明,该算法实现的语法分析器完全可以达到工程要求。  相似文献   

7.
本文提出了构造优化和加速LR(K)语法分析器的一个新算法。它作为多功能LR语法分析器自动构造系统——XYZ/PG的主体,已用PASCAL语言在NORD-500型计算机上实现。与目前堪称最优的Pager算法相比较,本文算法通常可得到体积更小的LR(K)语法分析器。  相似文献   

8.
用词/语法分析器生成器实现软件系统的输入   总被引:3,自引:1,他引:2  
以软件系统输入模块的构造为例,提出了词/语法分析器生成器的一种非编译器构造的应用,阐述了用词/语法分析器生成器实现数据输入的优点,讨论了从数据的形式描述到数据输入的过程与设计原则,并通过实例强调了该方法的核心思想。  相似文献   

9.
文法具有二义性是实际中经常遇到的情况。本文以SLR(1)分析器为例介绍了一种为二义性文法构造语法分析器的方法,并通过实例分析了利用该方法进行语法分析的过程。  相似文献   

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

11.
Visual YACC is a tool that automatically creates visualizations of the YACC LR parsing process and synthesized attribute computation. The Visual YACC tool works by instrumenting a standard YACC grammar with graphics calls that draw the appropriate data structures given the current actions by the parser. The new grammar is processed by the YACC tools and the resulting parser displays the parse stack and parse tree for every step of the parsing process of a given input string. Visual YACC was initially designed to be used in compiler construction courses to supplement the teaching of parsing and syntax directed evaluation. We have also found it to be useful in the difficult task of debugging YACC grammars. In this paper, we describe this tool and how it is used in both contexts. We also detail two different implementations of this tool: one that produces a parser written in C with calls to Motif; and a second implementation that generates Java source code. Copyright © 1999 John Wiley & Sons, Ltd.  相似文献   

12.
Thomas R. Kramer 《Software》2010,40(5):387-404
A method is described for repairing some shift/reduce conflicts caused by limited lookahead in LALR(1) parsers such as those built by bison. Also, six types of Extended BNF (EBNF) construct are identified that cause a shift/reduce conflict when a Yet Another Compiler Compiler (YACC) file translated directly from EBNF is processed by bison. For each type, a replacement EBNF construct is described representing the same grammar and causing no shift/reduce conflict when its YACC equivalent is processed by bison. Algorithms are given for identifying instances of each type and transforming them into their replacements. The algorithms are implemented in an automatic parser builder that builds parsers for subsets of the DMIS language. The parser builder reads an EBNF file and writes C++ classes, a YACC file, and a Lex file, which are then processed to build a parser. The parsers build a parse tree using the C++ classes. The EBNF for DMIS is written in natural terms so that natural C++ classes are generated. However, if translated directly into YACC, the natural EBNF leads to 22 shift/reduce conflicts that fall into the six types. The parser builder recognizes the six constructs and replaces them automatically before generating YACC. The YACC that is generated parses in terms of unnatural constructs while building a parse tree using natural C++ classes. The six types of construct may occur in any statement‐based language that uses a minor separator, such as a comma; hence knowing how to recognize and replace them may be broadly useful. Published in 2010 by John Wiley & Sons, Ltd.  相似文献   

13.
介绍一种利用YACC(Yet Another Compiler-Compiler)技术实现检测网络服务器程序异常行为的新方法。该方法用一种携带语义标注的上下文无关文法描述服务器程序正常行为模式,利用YACC自动生成的语法分析器构成异常检测引擎,并利用YACC提供的错误处理和语义处理接口对异常现场进行分析。实验结果表明,该方法不仅能有效检测各种利用服务器程序漏洞进行的缓冲区溢出、堆内存破环等入侵方式,而且能实时地对异常行为进行分析追踪并向安全管理人员提供入侵相关详细信息,而这种能力正是目前同类方法所缺乏的。  相似文献   

14.
A wide range of parser generators are used to generate parsers for programming languages. The grammar formalisms that come with parser generators provide different approaches for defining operator precedence. Some generators (e.g. YACC) support precedence declarations, others require the grammar to be unambiguous, thus encoding the precedence rules. Even if the grammar formalism provides precedence rules, a particular grammar might not use it. The result is grammar variants implementing the same language. For the C language, the GNU Compiler uses YACC with precedence rules, the C-Transformers uses SDF without priorities, while the SDF library does use priorities. For PHP, Zend uses YACC with precedence rules, whereas PHP-front uses SDF with priority and associativity declarations.The variance between grammars raises the question if the precedence rules of one grammar are compatible with those of another. This is usually not obvious, since some languages have complex precedence rules. Also, for some parser generators the semantics of precedence rules is defined operationally, which makes it hard to reason about their effect on the defined language. We present a method and tool for comparing the precedence rules of different grammars and parser generators. Although it is undecidable whether two grammars define the same language, this tool provides support for comparing and recovering precedence rules, which is especially useful for reliable migration of a grammar from one grammar formalism to another. We evaluate our method by the application to non-trivial mainstream programming languages, such as PHP and C.  相似文献   

15.
LALR(1)分析程序生成系统在编译器构造领域以外被许多普通软件开发者学习和使用.为帮助用户理解LALR(1)分析器方法,编写出正确、完整、无语法分析冲突的文法规范,严格定义了使用LALR(1)分析器生成器时用户可能遇到的几类文法问题,描述一个为帮助用户解决这些问题而开发的LALR(1)分析器可视化和断点调试系统VPGE.VPGE以多种视图显示LALR(1)分析器的数据结构,包括状态栈、符号栈、输入符号串、分析树和底层的自动机,支持LR分析动作的单步执行和断点调试.性能实验结果表明,VPGE比GNU的Bison有更快的分析器生成速度,从而提供了一个LALR(1)文法及分析器的快速交互式调试环境.  相似文献   

16.
17.
VHDL语言高级综合子集的确立及其实现方法   总被引:7,自引:2,他引:7  
越来越多的高级综合系统采用或接受VHDL语言作为设计输入,但VHDL语言的语义本质是基于模拟而非基于高级综合的,许多语法现象不能或不适于进行综合。本文系统地分析了VHDL语言的可综合性问题,详细讨论了VHDL语言的各种语法现象的可综合性,并结合实际系统分析了VHDL语言高级综合子集的确立及实现方法。  相似文献   

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

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